C Programming Data Types

int – Integer data types

Integers are whole numbers that can have both positive and negative values but no decimal values. Example: 0, -5, 10

In C programming, keyword int is used for declaring integer variable. For example:

int id;

Here, id is a variable of type integer.

You can declare multiple variable at once in C programming. For example:

int id, age;

float – Floating types

Floating type variables can hold real numbers such as: 2.34, -9.382, 5.0 etc. You can declare a floating point variable in C by using either float or double keyword. For example:

float accountBalance;

double bookPrice;

Here, both accountBalance and bookPrice are floating type variables.

In C, floating values can be represented in exponential form as well. For example:

float normalizationFactor = 22.442e2;

Difference between float and double

The size of float (single precision float data type) is 4 bytes. And the size of double (double precision float data type) is 8 bytes. Floating point variables has a precision of 6 digits whereas the precision of double is 14 digits.


char – Character types

Keyword char is used for declaring character type variables. For example:

char test = ‘h’;

Here, test is a character variable. The value of test is ‘h’.

The size of character variable is 1 byte.

Storage size and value rang of data types 

2,878 thoughts on “C Programming Data Types

  1. I precisely desired to thank you so much yet again. I am not sure what I could possibly have made to happen in the absence of the actual tricks shared by you over such subject. This was the daunting problem for me personally, nevertheless being able to see the specialised manner you resolved that forced me to jump over happiness. I’m grateful for your information and even trust you are aware of a great job you’re putting in educating the mediocre ones through your web site. I’m certain you have never got to know any of us.

Leave a Reply

Your email address will not be published.