C Program to Find Size of int, float, double and char of Your System | ZenTek ZenTek: C Program to Find Size of int, float, double and char of Your System
Contact Us:

If You Have Any Problem, Wanna Help, Wanna Write Guest Post, Find Any Error Or Want To Give Us Feedback, Just Feel Free To Contact Us. We Will Reply You Soon.

Name: *


Email: *

Message: *


ZenTek

LiveZilla Live Help

C Program to Find Size of int, float, double and char of Your System

The size of a character is always 1 byte but, size of int, float and double variables differs from system to system. This program will compute the size of int, float, double and char of you system using sizeof operator. The syntax of size of operator is:

 
temp = sizeof(operand);
/* Here, temp is a variable of type integer,i.e, sizeof() operator 
   returns integer value. */

Source Code


/* This program computes the size of variable using sizeof operator.*/

#include <stdio.h>
int main(){
    int a;
    float b;
    double c;
    char d;
    printf("Size of int: %d bytes\n",sizeof(a));
    printf("Size of float: %d bytes\n",sizeof(b));
    printf("Size of double: %d bytes\n",sizeof(c));
    printf("Size of char: %d byte\n",sizeof(d));
    return 0;
}

Output

Size of int: 4 bytes
Size of float: 4 bytes
Size of double: 8 bytes
Size of char: 1 byte

Note: You may get different output depending upon your system.

Explanation

In this program, 4 variables a, b, c and d are declared of type int, float, double and char respectively. Then, the size of these variables is computed using sizeof operator and displayed.


Like the Post? Share with your Friends:-

Team SB
Admin: Akash

0 comments:

POST A COMMENT

Contact Us

Name

Email *

Message *

 

About Me

Hello Guys

I am an IT(Information Technology) Student design this blog for your Preference I always enjoyed technical things as a kid

now here i am sharing my knowledge about Tips and Tricks In Internet PC Windows Free Recharges and Other Cool Stuffs Too

So enjoy it

Followers

Widget by : ZenTek
Widget by : ZenTek
Copyright © . ZenTek. All Rights Reserved.
Designed by :-Way2themes