Right Click to Search

Wednesday, March 24, 2025

Printf MCQ 22 : sizeof (octal + hexadecimal + integer )



Printf Multiple Choice Questions 21  : Sum of three Different Numbers

Predict the Output of the Following Program if Given Things are - 
#include<stdio.h>
void main()
{
int num1 = 0x20 + 020 + 20;
printf("%d",sizeof(num1));
getch();
}
Options :
  1. 2
  2. 4
  3. 30
  4. Garbage

Output :

Switch to Printf MCQ Home :  Click Here

How and Why ?
  1. Sum of Three numbers belonging to Different number system is assigned to Variable 'num1' which is of integer Type
  2. So result is Typecasted into Integer
  3. Size of Integer is 2 bytes

  Bookmark & Share

Tags / Keywords : |

Stumble
Delicious
Technorati
Twitter
Facebook

0 Comments:

Post a Comment

Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email

 

Learn C Programming Copyright © 2010 LKart Theme is Designed by Lasantha, Free Blogger Templates