Write a simple program to find the size of different basic
data types in C.

Answers were Sorted based on User's Feedback



Write a simple program to find the size of different basic data types in C...

Answer / rajiv

int x,y,b;
char a;
x=sizeof(y);
b=sizeof(a);
printf("the size of int is %d & the size of char is
%d",x,b);

Is This Answer Correct ?    20 Yes 4 No

Write a simple program to find the size of different basic data types in C...

Answer / jugad

#include
#include
int main()
{
printf(ā€œ%d %d %d %dā€,sizeof(int),sizeof(unsigned
int),sizeof(float),sizeof(char));
getch();
return 0;
}

courtesy:http://answerwale.co.cc/?p=23

Is This Answer Correct ?    21 Yes 7 No

Write a simple program to find the size of different basic data types in C...

Answer / gajendra patil

#include <stdio.h>
#include <conio.h>

int main(){

int *a;
printf("\nSIZE OF DIFFERENT DATA TYPES\n");
printf("\n------------------------------");
printf("\n\tBASIC");
printf("\n------------------------------");
printf("\nCHARACTER \t: %d byte(s)",sizeof(char));
printf("\nSHORT \t\t: %d byte(s)",sizeof(short));
printf("\nINTEGER \t: %d byte(s)",sizeof(int));
printf("\nLONG \t\t: %d byte(s)",sizeof(long));
printf("\nFLOAT \t\t: %d byte(s)",sizeof(float));
printf("\nDOUBLE \t\t: %d byte(s)",sizeof(double));
printf("\nLONG DOUBLE \t: %d byte(s)",sizeof(long double));
printf("\nLONG LONG \t: %d byte(s)",sizeof(long long));
printf("\nPOINTER (any) \t: %d byte(s)",sizeof(*a));
printf("\nARRAY \t\t: sizeOfDataType * sizeOfArray [eg. int a[10]=%d byte(s)]",sizeof(int)*10);
printf("\n------------------------------");

return 0;
}

Is This Answer Correct ?    5 Yes 2 No

Post New Answer

More C Interview Questions

By using C language input a date into it and if it is right?

0 Answers   Aricent,


When the macros gets expanded?

0 Answers  


When should the const modifier be used?

0 Answers  


How can I copy just a portion of a string?

0 Answers  


Explain Function Pointer?

0 Answers   Wipro,






which type of question asked from c / c++ in interview.

2 Answers  


consider the following structure: struct num nam{ int no; char name[25]; }; struct num nam n1[]={{12,"Fred"},{15,"Martin"},{8,"Peter"},{11,Nicholas"}}; ..... ..... printf("%d%d",n1[2],no,(*(n1 + 2),no) + 1); What does the above statement print? a.8,9 b.9,9 c.8,8 d.8,unpredictable value

4 Answers   TCS,


Suggesting that there can be 62 seconds in a minute?

0 Answers  


How to draw the flowchart for structure programs?

0 Answers  


program to find a smallest number in an array

15 Answers   Microsoft, Sony,


How can you print HELLO WORLD without using "semicolon"?

7 Answers   HCL, Infosys,


What are reserved words with a programming language?

0 Answers  


Categories