0

Why this outputs "lolearn" ??

char *s="sololearn"; s++; ++s; printf("%s",s);

31st Jan 2021, 5:42 AM
[bool left=True;]
[bool left=True;] - avatar
5 Answers
+ 4
Because at first s++ is incrementing sololearn to ololearn and ++s is incrementing ololearn to lolearn
31st Jan 2021, 5:44 AM
Atul [Inactive]
+ 4
https://code.sololearn.com/cEgcEjqEasB5/?ref=app Now I think so you have understood about it
31st Jan 2021, 5:46 AM
Atul [Inactive]
0
Atul what s is holding?? Address of sololearn or the string sololearn .pls explain .
31st Jan 2021, 5:49 AM
[bool left=True;]
[bool left=True;] - avatar
0
12345 yes
31st Jan 2021, 6:11 AM
Atul [Inactive]
0
Because you are printing s plus 2!!
31st Jan 2021, 7:54 AM
Nadia Banin
Nadia Banin - avatar