Data Types in C Programming

Data type is a keyword. It decide size of data in C/C++ programming which type of data can be stored in program.

In C/C++ all the data must be stored in the variable. There are different types of data so it is necessary to specify which type of data the variable should store to perform the data type having provided.

Data Types in C Programming

There are three types of data

  • Built-in Data types
  • User-defined Data types
  • Derived- Data types

Data Types Classification

1. Built-in/Predefined Data types:-

  • Such type of data type is already defined in the C Compiler.

EX:-int, float, char

2. User-defined Data types:-

  • Such type of data type which defined by a programmer for a specific purpose.

Ex:- Union, Structure, enum

3. Derived- Data types:-

  • Such type of data type which is defined derived from the primitive or built-in data types are called derived data type.

EX:- Array, Function, Pointer

1. Built-in/Predefined/Basic Data types in C Programming

There are four types of Basic data types

1. Character Data Type

  • It is declared such type of variable which contains character type of data.
  • Any single symbol written in a single code is called a character.
  • EX:-cse study
Memory size1 byte(8 bit)
Range 27 to 27-1
Decimal value -128 to 127
Format specifier %c and %s Where %s is used for string
unsigned int 0 to 255

2. Integer Data Type

  • It is declared as such type of variable that contains an integer type of data.
  • It is used to store the whole number.

Memory size 2 byte(16 bit)
Range 215 to 215-1
Decimal value -32768 to 32767
Format specifier %d
unsigned int 0 to 65535

3. Float Data Type

  • Float refers floating point or real number.
  • A float number using 6 decimal digit
  • EX:-24.234454
Memory size 4 byte(32 bit)
Range 231 to 231-1
Decimal value 3.4e-38 to 3.4e38
Format specifier %f

4. Double Data Type

  • Double also refers floating point and real numbers.
  • A double data type use 12 decimal digits.
  • EX:-2.563464575500
Memory size8 byte(64 bit)
Range 263 to 263-1
Decimal value 1.7e-308 to 1.7e308
Format specifier %lf

Summary of Data Type in C Programming

Data TypeMemory SizeRangeDecimal ValueFormat SpecifierValue
char1 BYTE (8 Bit)27 to 27-1-128 to 127%c /%s0 to 255
int2 BYTE (16 Bit)215 to 215-1-32768 to 32767%d0 to 65535
float4 BYTE (32 Bit)231 to 231-13.4e-38 to 3.4e38%f
double8 BYTE (64 Bit)263 to 263-11.7e-308 to 1.7e308%lf

Chapter Wise MCQs of C Programming

3Control Structure CLICKCLICK
4Looping StructureCLICK CLICK
8Structure and UnionsCLICKCLICK
Coming Soon All link is active ☺
error: Content is protected !!