I'm currently working through a C Programming text book as a refresher course and I'm a bit puzzled by this code.
Code:
int main()
{
char string[] = "This is a text string";
char *s;
s = string;
while(*s)
{
putchar(*s++);
}
return(0);
}
In itself this isn't a complicated code snippet, what I am puzzled about is the *s++. The text books states "The value stored at memory location s is read and displayed, and then memory location s is incremented." Is this right? As I understand it the unary incrementing operator ++ has a higher precedence than the dereferencing operator. Wouldn't the memory location be incremented first in this example?