Data Types In C Language
Today we will learn Data Types in C Languages with examples, so don’t waste time and let’s start the article. A specific community of a variable or constant is called data types. In simple words, when we create a variable during programming, then you have to tell the compiler how you are in the variable. The compiler provides the same memory to that variable from a computer memory (random access memory).
Types Of Data Types In C Programming Languages
- short int
- long int
- signed int
- unsigned int
We use the integer data type to store any Whole Number (not a decimal number). For example: 2, 5, etc. Integer takes 2 bytes of space in data type memory.
We use the float data type to store any Decimal Number. For example – 42.25, 34.4 etc. Float data types take up 4 bytes in memory, can store up to 7 digits after decimal in float data type.
We use the char data type to store any character. For example: ‘A’, ‘a’, ‘%’, ‘#’, ‘8’ etc. This data type takes 1-byte space in memory.
In double data type, we can store up to 17 digits after the decimal. The double data type takes 8-bytes of space in memory.
String data type is used to represent a name, such as if I want to print my name then the string data type has to be used. For Example: string name;
Integer Data Types, Storage Size, And Range
|Type||Storage Size||Value Range|
|int||2 bytes||-32,768 to 32,767|
|short int||1 byte||-128 to 127|
|long int||4 bytes||-2,147,483,648 to 2,147,483,647|
|signed int||2 bytes||-32,768 to 32,767|
|unsigned int||2 bytes||0 to 65,535|
|char||1 byte||-128 to 127|
|float||4 bytes||1.2E-38 to 3.4E+38|
|double||8 bytes||2.3E-308 to 1.7E+308|
|long double||10 bytes||3.4E-4932 to 1.1E+4932|
We often use Void Type: void data type in c programming, void means null value.
For Example: Void has no value. Void data type is used in situations when we have no information about the value. It is also used with functions, if the function does not return any value, then you define its return type void.
void hello(void); // function with no return value and parameter
If you like This Article Data Types in C Languages with examples then Give him Your Feedback In Comments.
Follow aCodiz me on Social Media Platform
and also share Knowledge With Your Friends…
Thanks and Read Our Other Articles