Size value from string into integer

main()
{
char ch=’a’;
printf(“%d,%d”,sizeof(ch),sizeof(“a”));
}
Tutorial answer:
1, 2
Debugging solution:
First sizeof value(sizeof(ch)):variable ch declare as the character so it will display character size value one
Value(sizeof(“a”)):a it is the constant value and then it does not declare as any variable so printf statement it contain %d so it will take no of character,no of character 1,but in the string it has null value so no of character 2:so answer is 2

Post a Comment

0 Comments