So I'm new to C and tested some things with pointers and I have a question about the following printf:
char txt[] = "thisIsAQuestion";
char *ptr = &txt[9];
printf("%c\n", ++(*ptr));
printf("%c\n", *ptr);
So following my "knowledge", it would go something like this:
The pointer points at the value 'e'. Then if I execute the first printf, first thing which is executed is the command which is in the (), so the dereference of the pointer *ptr, because it has higher priority over the Prefix Increment. Now what I think is that the ++ will act like (*ptr + 1), because the pointer got dereferenced already, and increments the value that the pointer is pointing to, but not change the pointer itself. So it would be 'f'.
But now when I run the second printf, it shows me that the pointer still points at 'f' and didn't "go back" to 'e'.
Is there an error in my thoughts? Or is there something else I didn't consider?