Data Types in C Language

data types in c is used to spicefy the type of data. in a c programming each data has its own type and different from other data like 5, 10, 25, 9, 30(Integer numbers) is different from 3.23, 14.32, 93.21(Real numbers) and 'T', '5', 'c', '@', '+' (Single Characters) is different from "Technorials", "A001"(String).
To Store Different types of data in memory we first need to define their data type. Data types are used to define a variable. In C language a variable should be declared before it can be used in program. Data types are the keywords, which are used for assigning a type to a variable. there are the data types in c language.

Integer data types in c

An Integer data type in c can not have a decimal point. Comma or Blank space is not allowed in integer data types. 
Data Type Storage Size Range
char 1 byte -128 to +127
unsigned char1 byte0 to 255
signed char1 byte-128 to 127
int2 or 4 bytes-32,768 to 32,767 or -2,147,483,648 to 2,147,483,647
unsigned int2 or 4 bytes0 to 65,535 or 0 to 4,294,967,295
short2 bytes-32,768 to 32,767
unsigned short2 bytes0 to 65,535
long4 bytes-2,147,483,648 to 2,147,483,647
unsigned long4 bytes0 to 4,294,967,295

The Size and range depends on platform, to get size of a variable on a particular platform, you can use sizeof operator.

Floating Point data types in c

An floating point type in c have a decimal point and can be written in two forms - Fractional form and Exponential form. If the value of a real constant is either too small or too large then real constant can be expressed in exponential form.0.0000794 can be written in 7.94e-5. Part before 'e' is called mantissa and part after 'e' is called exponent.
Data Type Storage Size Range Precision
float4 byte1.2E-38 to 3.4E+38 6decimal places
double8 byte2.3E-308 to 1.7E+30815 decimal places
long double10 byte3.4E-4932 to 1.1E+493219 decimal places

void type in c

void type specifies that no value is available and used as function return type, as function argument and pointers to void.

enum type in c

enum types in c are arithmetic types and used to define variables that can only assign certain discrete integer values throughout the program.
  


SHARE THIS
Previous Post
Next Post