+ 1
Sum of char in a int
Saw that code in a challenge (and I messed up). The output is "yo", and I have no idea of how it works. Someone could me explain? https://code.sololearn.com/cBzC2RJb2ODi/?ref=app
2 Respostas
+ 2
I've commented out the code you provided, braking it into small steps. Take a look ask if any particular step isn't clear.
https://code.sololearn.com/cuIykdknxlb4/?ref=app
UPDATE: Forgot to mention one important thing. x86 platform is little endian, so the least significant byte is stored first. So our integer 00006f79 is read backwards in the string, like 796f0000.
0
Amazing! I would never figure out what's going on... Had to learn some more to understand the explanation, and now I got it.
Thank you so much!