c - Code obfuscation do not understand -


i encountered following code

#include <stdio.h>  int main(void) {     long long p = 1,e = 2,t = 5,a = 61,l = 251,n = 3659,r = 271173410,g = 1479296389,               x[] = { g * r * e * e * t , p * l * * n * e * t };     puts((char*)x);     return 0; } 

the case not quite understand how works,it confusing me. can please explain in detail?

edit: 1 more thing, how print "hola mundo!" ("hello world" in spanish) analogically?

oh, 1 fun. declare many long long variables, , 1 long long array of 2 cells. array therefore made of 16 bytes.

given each byte 1 ascii character, array represents 16 characters (while last 1 zero). can see that:

g * r * e * e * t = 1479296389 * 271173410 * 2 *2 * 5 = 8022916924116329800 =  0x6f57206f6c6c6548  p * l * * n * e * t = 1 * 251 * 61 * 3659 * 2 * 5 = 560229490 =  0x21646c72 

given processor little endian, array's in-memory representation is:

48 65 6c 6c 6f 20 57 6f 72 6c 64 21 00 00 00 00 

which hello world!\x00\x00\x00\x00 in ascii.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -