I have a sample code in C below:
#include<stdio.h>
int main(){
int out = 4 + '4';
printf("%d",out);
return 0;
}
When I run it, the output value it return is 56. Can someone explain why?
I have a sample code in C below:
#include<stdio.h>
int main(){
int out = 4 + '4';
printf("%d",out);
return 0;
}
When I run it, the output value it return is 56. Can someone explain why?
ASCII value of '4' is 52.
Char value '4' has integer value 52 which is its ASCII Code. This is added to integer value 4.
Thus the result 56