Fundamental Data Types in C
Chapter 4: Programming Basics
Unit 1
Chapter 1: Computer Basic*
*CS101 Computer Basic is a small separate course prerequisite for KCS101/KCS201 Programming for Problem Solving – Using C
Chapter 2: Terminology
Chapter 3: Idea of Algorithm
Chapter 4: Programming Basics
- Introduction to C Language
- Basic Structure of C Program
- Writing and executing the first C program
- Errors in C Programming
- Object Code and Executable Code
- Components of C Language
- Standard Input-Output in C Programming
- Fundamental Data Types
- Variables and Memory Locations
- Storage Classes
Unit 2
Chapter 5: Arithmetic Expressions and Precedence
Chapter 6: Conditional Branching
Unit 3
Chapter 7: Iteration and Loops
Chapter 8: Functions
Unit 4
Chapter 9: Arrays, Structure, Union, and Enumeration
Chapter 10: Basic Algorithms and their Complexity Coexistence
Unit 5
Chapter 11: Pointers
Chapter 12: File Handling
Chapter 13: Macros & Command-Line Arguments
Appendix
KCS151/KCS251 PPS Lab Exercise
PPS Previous Year Question Papers
Data Types in C

Primary Data Type
Integer Data Type
int num; or int num1, num2; or int num1 = 7, num2 = 5;
Floating Point Data Type
- float
- double
float g = 9.8; or double dis = 2.5E-52;
Character Data Type
char ch = ‘A’; or char in = 65;
Void Data Type
The void is an empty data type that represents nothing or no value. It is used as a function parameter and as a function return type. It also used to define void pointers. We will study it in detail later.
Data Type Qualifiers or Modifiers
- Size Qualifier
- Sign Qualifier
- Constant Qualifier
- Volatile Qualifier
Size Qualifiers
- long
- short
long double dis;
In this example size of the double data type variable is 8 bytes, but when we use long prefix variable size increased to 10 bytes.
Sign Qualifiers
- signed
- unsigned
signed int balance;
unsigned age;
Note: Variables without any sign qualifier are treated as signed variables.
Constant Qualifiers
const float pi = 3.1415;
Volatile Qualifiers
volatile int cost;
Data Type | Keyword | Size (in Bytes) | Range | Format Specifier |
Integer (Signed) | int or signed int | 2 | -32768 to 32767 | %d or %i, %o, %x |
Unsigned Integer | unsigned int | 2 | 0 to 65535 | %u |
Short Integer (Signed) | short int or signed short int | 2 | -32768 to 32767 | %d or %hi |
Unsigned Short Integer | unsigned short int | 2 | 0 to 65535 | %u or %hu |
Long Integer (Signed) | long int or signed long int | 4 | -2147483648 to 2147483647 | %ld or %li |
Unsigned Long Integer | unsigned long int | 4 | 0 to 4294967295 | %lu |
Floating Point | float | 4 | -3.4e38 to 3.4e38 | %f, %e or %E or %g or %G |
Double | double | 8 | -1.7e308 to 1.7e308 | %lf |
Long Double | long double | 10 | -1.7e4932 to 1.7e4932 | %Lf |
Character (Signed) | char | 1 | -128 to 127 | %c |
Unsigned Character | unsigned char | 1 | 0 to 255 | %c |
Note: Given sizes and ranges are for a 16-bit machine.
Derived Data Type
- Pointer
- Array
- Function
We will discuss Pointer, Array, and Function in detail later.
User-Defined Data Type
- Structure
- Union
- Enumeration or Enum
We will discuss Structure, Union, and Enumeration in detail later.