// sizeof operator in c programming language
// find the size of various types of datatypes
#include<stdio.h>
void main(){
printf("size of int: %d byte\n",sizeof(int));
printf("size of character: %d byte\n", sizeof(char));
printf("size of float: %d byte\n", sizeof(float));
printf("size of double: %d byte\n", sizeof(double));
printf("size of long double: %d byte\n", sizeof(long double));
printf("size of signed: %d byte\n", sizeof(signed int));
printf("size of unsigned int: %d byte\n", sizeof(unsigned int));
printf("size of short int: %d byte\n", sizeof(short int));
printf("size of long int: %d byte\n", sizeof(long int));
printf("size of signed short int: %d byte\n", sizeof(signed short int));
printf("size of unsigned short int: %d byte\n", sizeof(unsigned short int));
printf("size of signed long: %d byte\n", sizeof(signed long int));
printf("size of unsigned long int: %d byte\n", sizeof(unsigned long int));
}
size of int: 4 byte
size of character: 1 byte
size of float: 4 byte
size of double: 8 byte
size of long double: 12 byte
size of signed: 4 byte
size of unsigned int: 4 byte
size of short int: 2 byte
size of long int: 4 byte
size of signed short int: 2 byte
size of unsigned short int: 2 byte
size of signed long: 4 byte
size of unsigned long int: 4 byte
Press any key to continue . . .
First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.
Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.