Good day group.
I was asked in an interview to explain the behavior of this program.
void main()
{
char *s = "abc";
int *i = (int *) s;
printf("%x", *i);
}
The question is: why is the output 636261? I don't think I know enough
about C to understand how the conversions between pointer types are
occurring.
Thanks for any help.
RD
I was asked in an interview to explain the behavior of this program.
void main()
{
char *s = "abc";
int *i = (int *) s;
printf("%x", *i);
}
The question is: why is the output 636261? I don't think I know enough
about C to understand how the conversions between pointer types are
occurring.
Thanks for any help.
RD
Comment