Write a C program to find size of variables using sizeof() operator. Here’s simple program to find size of variables using sizeof() operator in C Programming Language.
Below is the source code for C program to find size of variables using sizeof() operator which is successfully compiled and run on Windows System to produce desired output as shown below :
SOURCE CODE : :
/* C program to find size of variables using sizeof() operator */
#include <stdio.h>
int main()
{
char a ='Z';
int b =45;
float c =345.0f;
double d =7654.90;
char str[] ="Codezclub";
printf("Size of a: %d\n",sizeof(a));
printf("\nSize of b: %d\n",sizeof(b));
printf("\nSize of c: %d\n",sizeof(c));
printf("\nSize of d: %d\n",sizeof(d));
printf("\nSize of str: %d\n",sizeof(str));
return 0;
}
OUTPUT : :
/* C program to find size of variables using sizeof () operator */
Size of a: 1
Size of b: 4
Size of c: 4
Size of d: 8
Size of str: 10
Above is the source code for C program to find size of variables using sizeof () operator which is successfully compiled and run on Windows System.The Output of the program is shown above .
Below is the source code for C program to find size of variables using sizeof() operator which is successfully compiled and run on Windows System to produce desired output as shown below :
SOURCE CODE : :
OUTPUT : :
Above is the source code for C program to find size of variables using sizeof () operator which is successfully compiled and run on Windows System.The Output of the program is shown above .
need an explanation for this answer? contact us directly to get an explanation for this answer