C Programming language

adplus-dvertising
Primitive Data Types in C Programming Language
Previous Home Next

Built in data type is called as primitive data types. The basic primitive data types in C are such as Character, (char); Integer (short int, int, long int, long long int); Floating-point number (float, double); Boolean; and etc.

Long Integer

long integer is a data type that can represent a whole number whose range is greater than or equal to that of a standard integer on the same machine. The range of long integer is -2147483648 to 2147483647.

long int color;
// OR
long color;;
Short Integer

The range of short int is -32768 to -32767.'short int' should assign less than or the same amount of storage as an 'int' and the 'int' should be less or the same bytes than a 'long int'. short int must be at least 16 bits long.

short int yellow;
Unsigned Integer

unsigned int has a range of 0 - 65535. "int" can be negative, but "unsigned int" cannot be negative. %u Prints an unsigned integer. The size can range from 2 to 8, or (again) whatever the implementation provides.

unsigned int x; 
unsigned char grey;
Signed Integer

%d Prints a signed integer. Range of signed int is -32768 to 32767.

signed int y; 
signed char white;
Signed and Unsigned Char

C allows the character type char to be signed or unsigned, depending on the platform and compiler. With an unsigned char, the variable c takes the value 255, but with a signed char it becomes -1. If the signed or unsigned version of char is explicitly required at certain points in a program, it can be specified using the declarations signed char or unsigned char.

unsigned char grey;
signed char white;
Non Primitive Data Types

Example Integer, Float etc. An instance for non-primitive data type can not be created. .A non-primitive data type is an abstract data type. Non-primrtive data types built out of primitive data types - linked list, queue, stack, etc.

Previous Home Next