printf(4 + "foobar") | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

printf(4 + "foobar")

It seems that by changing the number, you shift the output by the given number (i.e. printf(4 + "foobar") // ar ). WTF? I don't understand exactly why.

13th Jun 2019, 11:48 AM
Out of Bounds
Out of Bounds - avatar
1 Answer
+ 2
Ok, it is just treating "foobar" as a pointer to the string, and then doing string arithmetic!
13th Jun 2019, 12:24 PM
Out of Bounds
Out of Bounds - avatar