what is the meaning of subtraction of two pointers??
return str-temp
Code:#include <stdio.h> #include <string.h> int what(char *str, char ch){ char *temp; for( temp = str; *str; str++) if(*str != ch) *temp++ = *str; *temp = ‘\0’; return str-temp; } void main(){ char string[ ]= "xbxbabsxdx"; printf(“result = %d\n”, what(string, ‘x’)); puts(string); }




Reply With Quote