what is the output of the following code?
main()
{
int I;
I=0x10+010+10;
printf("x=%x",I);
}
give detailed reason
Answer Posted / 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 |
Post New Answer View All Answers
What are operators in c?
How are variables declared in c?
What is huge pointer in c?
What is a global variable in c?
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
Once I have used freopen, how can I get the original stdout (or stdin) back?
How will you print TATA alone from TATA POWER using string copy and concate commands in C?
Explain 'bus error'?
What is scanf_s in c?
What is wild pointer in c with example?
Explain modulus operator.
Write program to remove duplicate in an array?
What is include directive in c?
How does #define work?
When can you use a pointer with a function?