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


Please Help Members By Posting Answers For Below Questions

What are the advantages of external class?

598


What is the purpose of & in scanf?

603


Can we declare variable anywhere in c?

539


What is the difference between volatile and const volatile?

571


Apart from dennis ritchie who the other person who contributed in design of c language.

817






Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

671


What is structure padding and packing in c?

627


Explain what math functions are available for integers? For floating point?

618


This is a variation of the call_me function in the previous question:call_me (myvar)int *myvar;{ *myvar += 5; }The correct way to call this function from main() will be a) call_me(myvar) b) call_me(*myvar) c) call_me(&myvar) d) expanded memory

738


What is line in c preprocessor?

618


What does the error message "DGROUP exceeds 64K" mean?

729


writ a program to compare using strcmp VIVA and viva with its output.

1530


Is c compiled or interpreted?

672


Explain bit masking in c?

642


Can I initialize unions?

598