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

Tell me what is null pointer in c?

0 Answers  


a program that can input number of records and can view it again the record

0 Answers   Accenture,


What are examples of structures?

0 Answers  


What is the explanation for modular programming?

0 Answers  


write a programme to enter some number and find which number is maximum and which number is minimum from enterd numbers.

3 Answers  






How can I read a binary data file properly?

0 Answers  


Juxtapose the use of override with new. What is shadowing?

1 Answers  


What is echo in c programming?

0 Answers  


Dear Sir, we are required the bubble sorting programs Regs Prem

1 Answers  


What is the output of the program #include<stdio.h> #include<conio.h> void main() {0 int i,j=20; clrscr(); for(i=1;i<3;i++) { printf("%d,",i); continue; printf("%d",j); break; } getch(); }

4 Answers   CTS, Oracle,


What is the difference between volatile and const volatile?

0 Answers  


what are the advanced features of functions a) function declaration and prototypes b) calling functions by value or by reference c) recursion d) all the above

0 Answers  


Categories