+ 5

Check out the code below and please do explain me about why im getting output for this code as 'is This'.

int main() { cout << "This " +2<< "awesome!"-6; return 0; }

30th Nov 2016, 3:35 AM
fathima shahanaz
fathima shahanaz - avatar
2 Answers
+ 3
nice one. just played around. it seems that the String is seen as Pointer and with the numbers you refer to the Pointer place. this means if you write like +2 you start from the beginning +2 which explains the "is" and the -7 rewind your Pointer place to "This". i didn't know that this is possible, maybe it is not possible with every compiler. nevertheless curious if one can use it as an exploit :) [edit] no, you can not use it as exploit ;)
30th Nov 2016, 4:46 AM
Gunther Strauss
Gunther Strauss - avatar
0
Nice
31st Dec 2016, 5:21 AM
Ahmad Isah Adam
Ahmad Isah Adam - avatar