0% found this document useful (0 votes)
32 views9 pages

What Is Data Types in C Language ?: Datatype Specific The Size & Type of Values That Can Be Stored in An Variable

Data types in C specify the size and type of values that can be stored in variables. There are primitive, derived, and user-defined data types in C. Primitive data types include int, char, float, double, and void. Int stores whole numbers without decimals using at least 2 bytes. Char stores single characters using 1 byte. Float and double store decimal numbers with single and double precision using at least 4 and 8 bytes respectively. Void represents nothing and has no values.

Uploaded by

Govindram
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views9 pages

What Is Data Types in C Language ?: Datatype Specific The Size & Type of Values That Can Be Stored in An Variable

Data types in C specify the size and type of values that can be stored in variables. There are primitive, derived, and user-defined data types in C. Primitive data types include int, char, float, double, and void. Int stores whole numbers without decimals using at least 2 bytes. Char stores single characters using 1 byte. Float and double store decimal numbers with single and double precision using at least 4 and 8 bytes respectively. Void represents nothing and has no values.

Uploaded by

Govindram
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

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;
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

(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

(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
#include <conio.h> Bhaisma
void main()
{
char gtr;
gtr = govt. collage Bhaisma;
printf(“The character value is: %c ”,
gtr);
getch();
}
“ 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)
Classification Data Types in c

Primitive Derived User-Defined

int Array Structure

char String Union

Float / double Pointer Typedef

void Unum
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