Very elementary question concerning indirection

kevin.laux rkl at cbnewsh.ATT.COM
Fri Feb 16 03:54:26 AEST 1990


In article <7998 at hubcap.clemson.edu>, kaires at hubcap.clemson.edu (Robert G Kaires) writes:
| 
| main()
| {
|    char *pointer;
|    char string[300];
|       gets(string);
|       printf( "%c\n",*(strchr(string,40)) );   <---- line in question
|       pointer = strchr(string,40);
|       printf("%c\n",*pointer);
| }
| 
| "partest.c", line 6: illegal indirection
| "partest.c", line 7: warning: illegal combination of pointer and
| integer, op =
| 

	Did you include the header file <string.h|?  If not, then strchr()
defaults to a function that returns an int, not a character pointer.

--rkl



More information about the Comp.lang.c mailing list