Datatypes in C | Format specifiers in C | Uses of datatypes | Programming tutorials | C programming | C programming tutorials
Hello guys, in this article we are going to learn about the datatypes in the C language. It means that we will learn about the different types of data that the C language allows and operates to produce the results.
In our daily life, we come across several datatypes like numerical, alphabetical etc. But in C, there are several other datatypes also available about which we will be going to learn in this article:-
- Integer
- Short integer
- Long integer
- Double
- Float
- Character
- String
In the C language, we need certain terms called ' Format Specifier ' to operate on these datatypes. Each datatype has its own and unique format specifier in the C language. Let us learn about the datatypes, their uses and also about their format specifiers.
Data Type | Format specifier | Uses | E.g. |
int | "%d" | for declaring variables containing integers | int x= 79464; |
short int | "%hd" | for declaring Variables containing short integers | int x=10; |
long int | "%ld" | for declaring Variables containing long integers | int y=45646464846744984; |
double | "%lf" | for declaring variables containing decimal values | double x= 3.59876756 |
float | "%f" | for declaring variables containing short decimal values | float x= 2.13 |
char | "%c" | for declaring variables containing a single symbol or alphabet. | char c= 'a' |
*NOTE:- "String" is a special datatype. So, we'll learn it later in the arrays chapter in details. String is a datatype which can contain a collection of numerical,
alphabetical data and special characters in it at the same time.
Till then, Stay safe & Stay healthy. Have a nice day!!
Comments
Post a Comment