/data-type-in-c

A simple program prints out the size of the data type and its range

Primary LanguageC

Data Type in C programming language

A simple program prints out the size of the data type and its range.

Complie and Run a C program

$ gcc -o datatype datatype.c
$ ./datatype

Result

Size of Data Types in C
=======================
Size of char = 1 Byte
Size of short = 2 Bytes
Size of int = 4 Bytes
Size of long = 8 Bytes
Size of float = 4 Bytes
Size of double = 8 Bytes

The Range of Data Types in C
=======================
Range of signed char -128 to 127
Range of unsigned char 0 to 255

Range of signed short int -32768 to 32767
Range of unsigned short int 0 to 65535

Range of signed int -2147483648 to 2147483647
Range of unsigned int 0 to 4294967295

Range of signed long int -9223372036854775808 to 9223372036854775807
Range of unsigned long int 0 to 18446744073709551615

Range of signed long long int -9223372036854775808 to 9223372036854775807
Range of unsigned long long int 0 to 18446744073709551615

Range of float 1.175494e-38 to 3.402823e+38
Range of double 2.225074e-308 to 1.797693e+308
Range of long double 3.362103e-4932 to 1.189731e+4932

한국인들이 제 오래된 블로그에 들어와 이야기 하는걸 보고 아주 짧은 코드를 작성해서 올려 보았습니다.