Write a C program to find size of variables using sizeof() operator

By | 03.11.2016

Find size of variables using sizeof() operator


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 .

If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.


Thanks for reading the post….

5 3 votes
Article Rating
Category: Basic Programs C Programming Tags:

About Tunde A

My name is Tunde Ajetomobi, a Tech Enthusiast and Growth Hacker. I enjoy creating helpful content that solves problem across different topics. Codezclub is my way of helping young aspiring programmers and students to hone their skills and find solutions on fundamental programming languages.

Subscribe
Notify of
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Majorsys.com

This post is priceless. When can I find out more?

codezclub  Post author

just comment what program do u want , we provide u better support .Thanks