Data Types in C Language:
C data types are used to determine which type of value is to be stored in the variable (memory block) and it also determines the return type of the functions. C programming is very rich In data types.
C programming provides different types of data types to store the values in variables. c data types are given below –
Basic Data Types
Int
Float
double
Char
void
Derived Data Types
Array
Pointer
Structure
Basic data types
Integer
integer type can store whole numbers including positive and negative numbers. Int keyword is used to declare integer type.
For example:
int a=20;
int a,b;
Floating type
Floating types can store the real numbers.real number means
number having floating point up to one precision. Float keyword is used to declare
floating type.
For example
float a=10.5
Double type
Double type stores the real numbers which having double precision. Double keyword is used to declare double type.
For example:
double a=255.30;
Character type
Character types can be store single character. Char keyword used to declare character type.
For example:
char a=’c’;
char b=’5’;
Void type
Void type stores nothing. Void means nothing. Void is usually used to declare the return type of function which doesn’t return any value.
Modifying the Basic Types
basic data types have various modifiers preceding them. A type modifier helps base type to more precisely fit a specific need.
The list of modifiers are:
Signed
Unsigned
Long
short
The int base type can be modified by as short, long, signed and unsigned and long can be modified as double. The char type can be modified as unsigned and signed.
following table shows the data type its size and range.
Derived data types
Array
Array is nothing but the collection of the same data types values.
Pointer
Pointer points the other memory location.
Structure
Structure is the collection of different data types.
Post a Comment