+ 1
What is the output of this? cout<<5+"SOLOLEARN";
Please specify with reason.
3 Answers
+ 10
String literals are interpreted as char pointers pointing to the first character in the string. Adding 5 to the value of the address will shift the pointer 5 slots forward, pointing to character 'E'. Printing the string with 5 added to the string literal will hence print "EARN", starting from 'E', to the end of the string.
0
hasty rei thanks
0
This is actually amazing, never thought of that