Data Types In C Language with Examples

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).

data type in c Language with Example

Types Of Data Types In C Programming Languages

Integer

  1. int
  2. short int
  3. long int
  4. signed int
  5. unsigned int

Floating point:

  1. float
  2. double

Character

1. char

Integer:

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.

Float: 

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.

Char: 

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.

Double: 

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: 

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

TypeStorage SizeValue Range
int2 bytes-32,768 to 32,767
short int1 byte-128 to 127
long int4 bytes-2,147,483,648 to 2,147,483,647
signed int2 bytes-32,768 to 32,767
unsigned int2 bytes0 to 65,535
char 1 byte-128 to 127
float4 bytes1.2E-38 to 3.4E+38
double8 bytes2.3E-308 to 1.7E+308
long double10 bytes3.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.

Input

Output

Conclusion

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

https://www.wtfupdates.com/c-plus-plus/

LEAVE A REPLY

Please enter your comment!
Please enter your name here