0
char array question
char*a = "Coding"; char*b = (++a) + 3; cout << *b // output is n How did we get to the letter n? n is the 5th letter / element in the char array. ++a is equivalent to a=a+1. So char*b = (++a) + 3 is equivalent to char*b = a+4. Does this 4 represent the element number?
1 ответ
0
"Coding"
|
a
++a
"Coding"
|
a
b = a + 3;
"Coding"
| |
a b
Indexes and pointers start from 0