#include <stdio.h>
int main()
{
int a = '\12345';
printf("%d",a);
return 0;
}
Why is the printed result 5452853? I wonder what happened?
#include <stdio.h>
int main()
{
int a = '\12345';
printf("%d",a);
return 0;
}
Why is the printed result 5452853? I wonder what happened?
I combined phuclv's and Mark Dickinson's answers and I seem to understand that first of all
'\12345'
is equivalent to three characters'\123' = 1*8*8+2*8+3*1 = 83
;'4' = 52
;'5' = 53
. Then the result is equal to83*256*256+52*256+53 = 5452853
– HuangGuojun