








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!









2026 Edition
2026 Edition
In ‘C’, every variable is associated with the data type which determines the kind of value it can store. A data type also helps the compiler to determine the memory required for storing the value and the operations that can be performed on it. ‘C’ provides several data types to represent different kinds of data such as integers, characters, floating-point numbers and user defined data. This module covers : •Concept of data types •Classification of data types in C •Basic/Fundamental data types •Derived data types •User defined data types, •Void data type •Type qualifiers •Type modifiers •Size and range of different data types •Examples and practical usage of data types
Fundamental data types are the basic built-in data types provided by the ‘C’ language. The five primitive or fundamental data types in ‘C’ programming language are: 1) Integer(int) – These are used for storing whole numbers, such as 5, 8, 67, 2390, etc. Decimal part is never included in it. It can store positive, negative and Zero values. It is represented as int during programming part. 2) Character(char) – It is used to store a single character. It refers to all ASCII character sets as well as the single alphabets, such as ‘x’, ‘Y’, etc. A character is always enclosed in single quotes. Internally it is represented by numeric character code. 3) Floating-point(float) – This refer to all the real number values or decimal points with single precision, such as 40.1, 820.673, 5.9, etc. 4) Double(double) – This include all large types of numeric values that do not come under either floating- point data type or integer data type. It is required when more precision is required such as 56743. 5) Void – This term refers to no value or no type at all. This data type is mostly used when defining the functions in a program that do not breturn any value
2026 Edition
Storage & Range of Fundamental Data Type
Behaves differently with scanf() : %d strictly reads decimal(base 10) numbers , while %i can automatically detect decimal, octal(prefixed with O), hexadecimal(prefixed with Ox) inputs. Behave identically with printf()
•Type modifiers signed , unsigned , long, and short are prefixed and used with integer base data types. •Type modifiers signed and unsigned are used for char.
•It is an integer type modifier, not a separate fundamental data type. •This type modifier is used to save memory space. •They are used to modify the maximum and minimum value the data type will hold. •short is used only for small integers. •There does not exist any short floating type. Example – short int a = 21324; short a; //keyword int can be omitted
2026 Edition
Output: The size of the short variable is 2 Bytes The size of the short int variable is 2 Bytes
#include int main() { short value = 23; short int value_two = 45; printf("The size of short variable is %d Bytes\n", sizeof(value)); printf("The size of short int variable is %d Bytes", sizeof(value_two)); return 0; }
•This special keyword is used for holding both positive as well as negative numbers, including zero. •This type modifier is the default modifier for integer and char data type. Example
int a = 30 ;
int b = -30 ;
signed int z = 45 ;
signed int x = -100 ;
signed char c = ‘A’ ; // It consumes 8 bits of memory with sign bit in its memory
2026 Edition
Type Format Specifier Bytes Range
signed char (^) %c 1 -128 to + unsigned char %c 1 0 to 255 int %d, %i 2 -32,768 to +32, signed int %d, %i 2 Same as int unsigned int %u 2 0 to 65, signed short int %hd 2 Same as int unsigned short int %hu 2 0 to 65,
long %ld, %li 4 -2,147,438,648 to+2,147,438,
signed long %ld, %li 4 Same as long unsigned long %lu 4 0 to 4,294,967, float %f 4 -3.4e38 to +3.4e double %lf 8 -1.7e308 to +1.7e