Each data type requires different amounts of memory and has some specific operations which can be performed over it. The data type is a collection of data with values having fixed values, meaning as well as its characteristics Integer character floating double etc. Types PrimitiveData Types User Defined Data Types Derived Types
Primitive Data Types
Primitive data types are the most basic data types that are used for representing simple values such as integers, float, characters, etc. User Defined Data Types Theuser-defined data types are defined by the user himself. Derived Types The data types that are derived from the primitive or built-in data types are referred to as Derived Data Types. Data Types in C Example of data types #include <stdio.h>
intmain() { // Integer data type int integerVar = 10;
// Floating-point data type
float floatVar = 3.14;
// Character data type
char charVar = 'A'; • // Double data type • double doubleVar = 123.456;
whose values cannot be modified once they are declared in the C program We define a constant in C language using the const keyword Types of Constants in C Integer Constant Character Constant Floating Point Constant Double Precision Floating Point Constant Array Constant Structure Constant // C program to illustrate constant variable definition #include <stdio.h>
int main() {
// defining integer constant using const keyword
const int int_const = 25;
// defining character constant using const keyword
const char char_const = 'A'; // defining float constant using const keyword const float float_const = 15.66; printf("Printing value of Integer Constant: %d\n", int_const); printf("Printing value of Character Constant: %c\n", char_const); printf("Printing value of Float Constant: %f", float_const); return 0; }