Hey. I am having trouble tracing this code. The output is
hursday March 30, 2006
March 30
but I cannot see why? From what I see, the str_ptr variable points at the String str, and this should point to the first element (T). Then the printf statement should print the letter h because it is incremented. After that it should print elemtent 8, which is y.
What am I missing here?
Thanks in advance
Code:
#include<stdio.h>
int main(void) {
char str[] = "Thursday March 30, 2006", *str_ptr;
str_ptr = str;
printf("%s\n", ++str_ptr);
str[17] = '\0';
printf("%s\n", str_ptr+7);
return(0);
}