sizeof()
function is used to get the memory allocated size in C programming language. See the below example with the output.
Below example will explain the data types such as int, float, char… etc and it will return the memory allocated size of the data types. Copy the below code and execute in c compiler to see the data type size.
1 2 3 4 5 6 7 8 9 | #include<stdio.h> int main() { printf("%d\n",sizeof(char)); printf("%d\n",sizeof(int)); printf("%d\n",sizeof(float)); printf("%d", sizeof(double)); return 0; } |
1
4
4
8
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: c program, c program examples, c program examples with output, c programs, sizeof operator in C, sizeof operator in C programming language