What is the largest data type for storing (and printing) an integer?

In C on a 32-bit system, what data type will store (and therefore print) the largest integer? Is it long longor unsigned long? Is there any unsigned long long? And what is the most accurate and politically correct?

+5
source share
4 answers

Your question is a bit unclear, but intmax_tis the largest sign with an integer type sign (and uintmax_tis the largest unsigned integer type). These are typedefs defined in <stdint.h>, but if you print them, you need <inttypes.h>instead, and PRInMAX macros for different values ​​of n.

+10
source

, bt defintly , , . , . , atoi, . , :)

#include<stdio.h>
#include<stdlib.h>

int main ()
{
    int i;
    char bigString [256];

    printf ("Enter a number: ");
    fgets (bigString, 256, stdin);

    i = atoi (bigString);
    printf ("The value entered is %d.",i);

    return 0;
}
+2

ISO C99 long long 64 , . unsigned long long. , , intmax_t uintmax_t.

bigint, GMP. ( ) .

+1

, , .

, 4- .

, . long long.

0

All Articles