C Programming (Functions pointer casting)
c, casting, function, pointers
Solution
`c3` is the `RET` instruction. When an x86 machine jumps to this string interpreted as code, it will execute `RET` and therefore jump right back without having done anything (the rest of the string is therefore ignored). Since standard calling convention on x86 is to put your return value in `eax`, but the code didn't do anything before returning, whatever was already in `eax` will still be there, and in a position for the C code to interpret it as having been "returned".
This is highly dependent on your machine being x86 and that you're allowed to cast between data and function pointers (and execute the result) - a very system-specific hack. This is not standard compliant or portable C by any stretch!
(`\xXX` is C's escape syntax for inserting single nonreadable characters into strings via their ASCII code in hex, if you didn't know that part.)
Problem
``` int eax = ((int(*)())("\xc3 <- This returns the value of the EAX register"))(); ``` How this works ? String is casted to function pointer