Three primary data types which are used in C language. Today I will introduce you to some variations in these primary data types in C. We can make unlimited data types as per our requirement in C. So C language is quite rich in data types.
What is Data Types? The data-type in a programming language is the collection of data with values having fixed meaning as well as characteristics. Some of them are an integer, floating point, character, etc. Usually, programming languages specify the range values for given data-type. Each data type requires different amounts of memory and has some specific operations which can be performed over it.
Where we can use Data Types ? 1)Identify the type of a variable when it declared. 2)Identify the type of the return value of a function. 3)Identify the type of a parameter expected by a function.
Types of Data Types :- 1)Primary(Built-in) Data Types: void, int, char, double and float. 2)Derived Data Types: Array, References, and Pointers. 3)User Defined Data Types: Structure, Union, and Enumeration.
we have only see the Built-in Data Types those are int,char,float,double,void 1)char : The most basic data type in C. It stores a single character and requires a single byte of memory in almost all compilers. 2)Int : As the name suggests, an int variable is used to store an integer. it’s only stored whole Numbers. 3)float : It is used to store decimal numbers (numbers with floating point value) with single precision. 4)double : It is used to store decimal numbers (numbers with floating point value) with double precision. 5)void: As the name suggests, it holds no value and is generally used for specifying the type of function or what it returns. If the function has a void type, it means that the function will not return any value. we also seen the which Data Types allocated how many bites in memory when you use those data types.
Example:-
What is Data Types? The data-type in a programming language is the collection of data with values having fixed meaning as well as characteristics. Some of them are an integer, floating point, character, etc. Usually, programming languages specify the range values for given data-type. Each data type requires different amounts of memory and has some specific operations which can be performed over it.
Where we can use Data Types ? 1)Identify the type of a variable when it declared. 2)Identify the type of the return value of a function. 3)Identify the type of a parameter expected by a function.
Types of Data Types :- 1)Primary(Built-in) Data Types: void, int, char, double and float. 2)Derived Data Types: Array, References, and Pointers. 3)User Defined Data Types: Structure, Union, and Enumeration.
we have only see the Built-in Data Types those are int,char,float,double,void 1)char : The most basic data type in C. It stores a single character and requires a single byte of memory in almost all compilers. 2)Int : As the name suggests, an int variable is used to store an integer. it’s only stored whole Numbers. 3)float : It is used to store decimal numbers (numbers with floating point value) with single precision. 4)double : It is used to store decimal numbers (numbers with floating point value) with double precision. 5)void: As the name suggests, it holds no value and is generally used for specifying the type of function or what it returns. If the function has a void type, it means that the function will not return any value. we also seen the which Data Types allocated how many bites in memory when you use those data types.
Example:-
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("size of int=%d\n",sizeof(int));
printf("size of float=%d\n",sizeof(float));
printf("size of char=%d\n",sizeof(char));
printf("size of double=%d\n",sizeof(double));
getch();
}
Comment below if you have any queries related to the above tutorial for an Datatypes In C programming language.
0 Comments