+ 4

DOUBT in a challenge !!

char *a="hello"; char* b= ++a +3; cout<<b; Output : o how??

18th Jan 2018, 8:56 AM
I'm_Groot
I'm_Groot - avatar
1 Answer
+ 3
a points to 'h' ++a increases it once, +3 - 3 more times, summary 4. a is of type char*, so a+4 will point to the 5th letter - it's 'o'
18th Jan 2018, 9:12 AM
Petr Leliaev
Petr Leliaev - avatar