The document discusses different data types in C language. It explains that data types determine the type of value stored in memory and the memory allocation depends on the data type. There are three basic data types in C - int, float, and char. Data types are divided into primitive, derived, and user defined types. Primitive types include int, unsigned int, long int, float, double, long double, char, and void. Derived types are derived from primitive types, including arrays, pointers and functions. User defined types allow users to create their own types like structures, unions and enums.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
19 views
17-7-23 Data Types in C
The document discusses different data types in C language. It explains that data types determine the type of value stored in memory and the memory allocation depends on the data type. There are three basic data types in C - int, float, and char. Data types are divided into primitive, derived, and user defined types. Primitive types include int, unsigned int, long int, float, double, long double, char, and void. Derived types are derived from primitive types, including arrays, pointers and functions. User defined types allow users to create their own types like structures, unions and enums.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3
DATA TYPES
Data type determines the type of value we are going to store in
our computer. To store anything in our computer, we should have to allocate the memory. This memory allocation is depended on the data type we are using. Data type determines the properties such as 1. No of bytes 2. Range 3. Type of value In C language we are having 3 basic data types 1. Int – To store non-decimal numbers 2. Float – To store decimal numbers 3. Char – To stores alphabets, numbers and special char Total data types are divided into 3 types. 1. Primitive data types 2. Derived data types 3. User defined data types
PRIMITIVE DATA TYPES:
These are the regular data types we are using in our c programs. Data type Bytes Conversion Storage Range Character / format specifier int / 2 %d -32768 to +32767 signed int / short int unsigned int 2 %u 0 to 65535 long int 4 %ld -2147483648 to 2147483647 unsigned 4 %lu 0 to 4294967295 long int float 4 %f 3.4 * 10-38 to 3.4 * 10 +38 double 8 %lf 1.7 * 10-308 to 1.7 * 10+308 long double 10 % Lf 3.4 * 10-4932 to 1.1*10+4932 char 1 %c 1 character Signed char [-128 to +127] Unsigned char [ 0 to 255 ] char[10] 10 %s 9 char + 1 null char (STRING) void [ empty nothing data type ]
DERIVED DATA TYPES:
They are derived from primitive data types. 1. Array [ non-primitive ] 2. Pointer 3. Function USER DEFINED DATA TYPES: These are the data types created by the user. 1. structure 2. union 3. enum