Very elementary question concerning indirection

Robert G Kaires kaires at hubcap.clemson.edu
Thu Feb 15 03:41:31 AEST 1990


Hello, 
I am just starting to learn C and I have what I'm sure is a very simple
question. Consider the following program fragment:

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 =

If the "line in question" is commented out, the program compiles with one
warning on line 7 (This is in Vax Ultrex C, no warning is given in Turbo
C). What is wrong with the "line in question". Also, what does this
warning mean?
Thanks for all replies!
Bob Kaires
  



More information about the Comp.lang.c mailing list