The output will be -1.
Because, when you typecast an int address to char pointer, the pointer will assume that there will be a character value stored at that pointer's location.
511 will be stored in memory like this - 00000000 00000000 00000001 11111111
Since char can only hold 1 bytes(8 bits) on all machines, it will take only least 8 significant bits of 511, i.e - 11111111. Or simply, char value at maximum will be 255, any value beyond it won't matter. 255 => 11111111
Now, when you print the value at char pointer as integer(char value), it will be printed as signed int, i.e. -1
I made a mistake about how 511 will be stored in memory. Please follow the answer by Abhishek yadav on this same page. Thanks, Abhishek!
When I mentioned max value for char is 255, I meant for unsigned char. By default, the compiler treats char as "signed char", ranging from -128 to 127. 11111111 as signed char is -1 integer value.