++ Operator Misunderstanding
I have the following code
Code:
#include <stdio.h>
void show_str(const char *test_str);
int main(void){
char* the_str = "A woodchuck could chop as much as a woodchuck could\n";
show_str(the_str);
return 0;
}
void show_str(const char *some_string){
//using bracket notation
int ndx = 0;
while(some_string[ndx]){
putchar(some_string[ndx++]);
}
//using increment operator
while( (*some_string) ){
putchar( *(some_string++) );
}
}
doesn't the ++ operator have higher precedence, and thus *(string + 1) should always be the first element that is sent to stdout? As it stands it starts printing from (string + 0).
It's been bothering me so if anyone can explain it another way that I'll I understand it would be appreciated.