if I would use a pointer into isspace function it should be an int or char pointer?Code:#include <ctype.h> int isspace(int c);
Code:if (isspace(*mypointer)) ...
if I would use a pointer into isspace function it should be an int or char pointer?Code:#include <ctype.h> int isspace(int c);
Code:if (isspace(*mypointer)) ...
why not try yourself?
it should be int, however if you use char the program will work, but the compiler will give you a warning:
Code:assignment from incompatible pointer type
thanks
OUTPUT: string hereCode:#include <stdio.h> #include <string.h> #include <ctype.h> void main() { char *p; char k[] = "your string here"; p=&k; while(!isspace(*p++)); printf("%s",p); }
I cant understand it.
printf("%s",p);
shouldnt be printf("%s",*p); ?
char *p;
shouldnt be int *p; ?
so, if change it BCC55 says:
Code:Error E2342 teste.c 9: Type mismatch in parameter '__s' (wanted 'const signed char *', got 'int') in function main
Should bevoid main()Code:int main(void);should bep=&k;orCode:p = k;Code:p = &k[0];Will outputCode:#include <stdio.h> #include <string.h> #include <ctype.h> int main(void) { char *p; char k[] = "your string here"; p=k; while(!isspace(*p++)); printf("%s",p); return 0; }string here
char *p;
shouldnt be int *p; ?
if the pointer is int it do not point to the string
it SHOULD NOT be an int pointer doing so will printout every 4th character. However if you are getting warnings/errors from the isspace() call then you can use:Which will cast the character to an int.Code:while(!isspace((int)*p++));