C Program to Demonstrate the Working of Keyword long | ZenTek ZenTek: C Program to Demonstrate the Working of Keyword long
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 Demonstrate the Working of Keyword long

Keyword long is used for altering the size of data type. For example: the size of int is either 2 bytes or 4 bytes but, when long keyword is used, the size of long int will be either 4 bytes or 8 bytes. Also, you can use long long int. The size of long long int is generally 8 bytes. This program will demonstrate the size of keyword long for my system. It may be different in your system.

Source Code


#include <stdio.h>
int main(){
    int a;
    long int b;                /* int is optional. */
    long long int c;            /* int is optional. */
    printf("Size of int = %d bytes\n",sizeof(a));
    printf("Size of long int = %ld bytes\n",sizeof(b));
    printf("Size of long long int = %ld bytes",sizeof(c));
    return 0;
}
 
Output
Size of int = 4 bytes
Size of long int = 4 bytes
Size of long long int = 8 bytes
In this program, the sizeof operator is used for finding the size of int, long int and long long int.
Thus, int and long int for my system can hold values from -231 to 231-1. If I have to work on data outside this range, I have to use long long int, which can hold values from -263 to 263-1 .
Similarly, the long keyword can be used double and floats types.


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