Data Types in C Programming
November 5, 2020
In C programming, you have to declare data types for variables during assignment or before assignment according to your desired operation. Data declaration determines the type and size of data associated with variables. In this tutorial, I will show you different data types in C programming language.
Let’s see an example of variable declaration:
int x,y,z;
x=5;
y=5;
z=x+y;
int x,y;
x=5;
y=5;
int z=x+y;
Here’s a table containing commonly used data types in C program.
Type | Size (Bytes) | Format Specifier |
---|---|---|
int |
at least 2, usually 4 | %d , %i |
char |
1 | %c |
float |
4 | %f |
double |
8 | %lf |
short int |
usually 2 | %hd |
unsigned int |
at least 2, usually 4 | %u |
long int |
at least 4, usually 8 | %ld , %li |
long long int |
at least 8 | %lld , %lli |
unsigned long int |
at least 4 | %lu |
unsigned long long int |
at least 8 | %llu |
signed char |
1 | %c |
unsigned char |
1 | %c |
long double |
at least 10, usually 12 or 16 | %Lf |
Click Operators in C to know how to use operators in C programming language.
In this tutorial, I have shown different data types used in C program. Hope you have enjoyed the tutorial. If you want to get updated, like the facebook page http://www.facebook.com/freetechtrainer and stay connected.