You are on page 1of 9

“ SWA. PYARELAL KANWAR” GOVT.

COLLEGE
BHAISMA, DIST- KORBA (C.G.)

B.Sc. ( Maths )
Topic - Data Types in C Language

Presentation By - Govindram
Class – B.Sc. Year ( Maths)

Guided BY
Mr. Deepesh Kumar
(Asst. Professor Physicis)
What is Data Types in C Language ?
• Datatype specific the size & type Of values that can be
stored in an variable .
Ex- int a=10;
Ex- float a=10.1544;
Classification Data Types in c

Primitive Derived User-Defined

int Array Structure

char String Union

Float / double Pointer Typedef

void Unum
Primitive Data Type
(1) int - As its name suggests, an int variable is used to store a whole number. It
stores zero, positive and negative values ​without decimal. Its size (bytes) is at
least 2 bytes and it’s format specifier %d, %i .

Ex. - Program CODE Output / Result


#include <stdio.h>
The integer value is: 20
#include <conio.h>
void main()
{
int i = 20;
printf(“The integer value is: %d ”, i);
getch();
}
Primitive Data Type
(2) char - It is the most basic data type in C. It stores a single character and requires
one byte of memory in almost all compilers. and it’s format specifier %c .

Ex. - Program CODE Output / Result


#include <stdio.h> The character value is : govt. collage Bhaisma
#include <conio.h>
void main()
{
char gtr;
gtr = govt. collage Bhaisma;
printf(“The character value is: %c ”, gtr);
getch();
}
Primitive Data Type

(3) float - It is used to store decimal numbers (numbers with floating point value)
with single precision . Its size is at least 4 bytes and it’s format specifier %f .

Ex. - Program CODE Output / Result


#include <stdio.h> The float value is : 3.124100
#include <conio.h>
void main()
{
float ab = 3.1241;
printf(“The float value is: %f ”, ab);
getch();
}
Primitive Data Type

(4) double - It is used to store decimal numbers (numbers with floating point value)
with double precision. Its size is at least 8 bytes and it’s format specifier %lf .

Ex. - Program CODE Output / Result


#include <stdio.h> The double value is : 51.598000
#include <conio.h>
void main()
{
double cd = 51.598;
printf(“The double value is: %lf ”, cd);
getch();
}
Primitive Data Type

(5) void - The void data type in C is used to specify that no value is present. It does
not provide a result value to its caller. It has no values and no operations. It is
used to represent nothing.

You might also like