Pejman Moghadam / C-programming

C - long long int data type

Public domain


#include <stdio.h>
#include <limits.h>

int main()
{
    long long int i;
    unsigned long long int j;

    i=1234567890123456789LL;
    j=12345678901234567890ULL;
    fprintf(stdout, "This is a 'long long int' number : %lld\n", i);
    fprintf(stdout, "This is an 'unsigned long long int' number : %llu\n", j);
    fprintf(stdout, "Number of bits in a 'long long int' type : %d\n",
            sizeof(long long int) * 8 );
    fprintf(stdout, "Minimum and maximum values a 'signed long long int' can hold : %lld %lld \n",
            LLONG_MIN, LLONG_MAX);
    fprintf(stdout, "Minimum and maximum values an 'unsigned long long int' can hold : 0 %llu \n",
            ULLONG_MAX);
    return 0;
}

--Output--

This is a 'long long int' number : 1234567890123456789
This is an 'unsigned long long int' number : 12345678901234567890
Number of bits in a 'long long int' type : 64
Minimum and maximum values a 'signed long long int' can hold : -9223372036854775808 9223372036854775807
Minimum and maximum values an 'unsigned long long int' can hold : 0 18446744073709551615

BY: Pejman Moghadam
TAG: c, data-type
DATE: 2011-02-28 19:51:00


Pejman Moghadam / C-programming [ TXT ]