Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Date: 17/06/2021

DATA TYPES:
The type of the data that we want to store in C Program is specified by Datatype.
C Language has 4 different Data types. They are;
1) Basic/Primary/Fundamental/Intrinsic/Implicit/Internal/Built-In Data Types
2) Derived/Secondary Data Types
3) User-Defined Data Types
4) Void Data Type

I) Basic Data Types:


The basic data types in C language are;
a) short
b) int
c) long
d) float
e) double
f) char
short, int and long belongs to Integer numbers type.
float, double belongs to real numbers type.
char belongs to character datatype
II) Derived Data types:
The data types that are derived from the basic data types are called as derived
data types.
a) Arrays
b) Strings
c) Functions
III) User-Defined Data types:
The data-types that are newly created by the users from the basic data types, then
they are called as user-defined data types.
IV) Void Data Type:
When the value is not known then we will assign a void type.

Variables:
A variable is a memory place to store a value.
Syntax:
datatype variablename = value;
Examples:
1)
int total = 850;
“total” is a variable in example 1.
“total” can store only integer type number.
2)
float avg = 77.32;
“avg” is a variable in example 2.
“avg” can store only real type number.
3)
char ch = ‘G’;
“ch” is a variable in example 3.
“ch” can store only character type data.
Characters that are to be stored in C program must always enclosed in single quotes.

You might also like