what is the output of the following code?
main()
{
int I;
I=0x10+010+10;
printf("x=%x",I);
}
give detailed reason
Answers were Sorted based on User's Feedback
Answer / yogesh bansal
Output of this program is 22
reason is :
0x10 is hexadecimal value which is equal to 16 in decimal.
010 is octal value which is equal to 8 in decimal
10 is decimal value
so total is 16+8+10= 34
I value is 34.
Now we are printing the value of I on hexadecimal using %x
34 is equal to 0x22 in hexadecimal.
so the output is 22 in hexadecimal
Hope its is clear to you
Is This Answer Correct ? | 70 Yes | 8 No |
Answer / kartik
Output of this program is 22
reason is :
0x10 is hexadecimal value which is equal to 16 in decimal.
010 is octal value which is equal to 8 in decimal
10 is decimal value
so total is 16+8+10= 34
I value is 34.
Note:The person above me has given the corrst infm however the output is 34.
Try and run the program in C Compiler
Is This Answer Correct ? | 12 Yes | 7 No |
What is pragma in c?
What is #line used for?
swap 2 numbers without using third variable?
c pgm count no of lines , blanks, tabs in a para(File concept)
How do you determine the length of a string value that was stored in a variable?
what is the use of c program?
4 Answers Synergy, Web Synergies,
How can I access memory located at a certain address?
main() { int i=5; printf("%d%d%d%d",i++,i--,i); }
How to define structures? ·
What are the different types of linkage exist in c?
What is action and transformation in spark?
What do you know about the use of bit field?