C Foundation

What is C? C Compiler Installation C Extensions C Compiler C Interpreter C Program Structure

C Basics

C Keywords C Data Types C Identifiers C Variables C Constant C Escape Sequences C Constant and Volatile C Typecast


What is Operator C Comma Operator C Arithmetic Operators C Relational Operators C Logical Operators C Bitwise Operators C Conditional Operators C : : Operator C Operator Priority

Basic IO's

Basic IO's C Formatted Functions C Unformatted Functions C Common Functions

Control Statements

What is Control Statement C if Statement C if else Statement C Nested if Statement C Else if Statement C Break Statement C Continue Statement C Switch Statement C Goto Statement


What is Control Loop C for Loop C Nested for Loop C while Loop C Nested while Loop C do while Loop C Nested do while loop


What is Function C User Defined Functions C Recursion C Passing Parameters


Scope C Local Scope C Global Scope

Storage Classes

What is Storage Class C Auto C Extern C Static C Register


What is Array C One Dimensional Array C Two Dimensional Array C Multi Dimensional Array C Arrays Of Strings


What is String C String Functions


What is Pointer C Pointers Arithmetic C Pointer to Pointer C Pointers and Arrays C Pointers and Strings C Pointer to Functions Void Pointers Null Pointers C Null and Void Pointer


What is Structure C Struct within Struct C Array within Structure C Pointer to Structure C Structure and Function C Enum C Bitfield Structure C Type def


What is Union


What is File C read a file C write a file C File Handling C Error Handling C Low Level Disk I/O C Other file functions

Memory Allocation

What is Memory Allocation C Malloc() C Calloc() C Free() C Realloc() C Coreleft()

C Reference

All ASCII Code Basic C Questions

C Interview

C Interview Sets All Star Patterns All Number Patterns All Alphabet Patterns All Series Patterns
The ones who are crazy enough to think they can change the world are the ones who do.
- Steve Jobs

C Data Types

What Is Data Type?

Data Type is nothing more than what type the data belongs to. In other words Data types are the storage format to store a data.

Why Data Types?

Data types are widely used in 90's programming languages like C, java and much more. Data types tells the compiler how to treat the data while performing any mathematical operation in it. Modern Compliers and Interpreters are capable of finding the types of data automatically so that users are provided with no-headache of mentioning data types. Languages like python, javascript, php etc are datatype free programming language.

C Data Types

C programming have minimal set of basic data types. Complex data types can be built using these basic data types. Data types are also known as primitive types. In C programming, the memory size of data types may change according to 32 (4 bytes) or 64 (8 bytes) bit operating system.

Types of Data Types

In C, 5 basic data types to define data.

  • int represent integer.
  • char represent character.
  • float represent floating point.
  • double represent 2 * integer.
  • void represent valueless.
Types of data type in C

Data Type's Size and Range

The following table will demonstrate Data type's size and Data type's range for clarity view.

Data Type Size (bits) Range
void 1 byte or 8 bits nothing
char 1 byte or 8 bits -128 to 127
int 2 byte or 16 bits || 4 byte or 32 bits -32768 to 32767 or -2,147,483,648 to 2,147,483,647
float 4 bytes or 32bits || 8 byte or 64 bits 3.4e-38 to 3.4e+38
double 8 byte or 64 bits 1.7e-308 to 1.7e+308

Conceptual Data Types

There are 2 types of conceptual data types in C programming

Derived data type Enumeration Data Type
array, pointer, structure, union enum

Format Specifiers

Format Spectifiers in Programming language tells us which type of data to store and which type of data to print or to output.

Data Type Keyword Format Specifier
character char %c
signed integer int %d or %i of %l
unsigned integer unsigned int %u or %lu
long double long double %ld
string char %s
floating point float %f
double floating point double %lf

Char Data Type in C

Char is a Data Type to store a single character. Generaly, char Data Type occupies 1 bytes i.e) 8 bits.

char Data Type Program

#include <stdio.h>
int main()
char a = 'b';
printf("The character of a = %c ",a);
return 0;
  • The character of a = b


Here char data type store a character b in variable a.

Integer Data Type

Integer is a Data Type to store an integer value. Generaly, Integer Data Type occupies 2 bytes or 4 bytes its highly depend on your operating system bit rates.

Integer Data Type Program

#include <stdio.h>
int main()
int a = 8;
printf("The value of a = %d ",a);
return 0;
  • The value of a = 8


Here int data type store an integer value 8 in variable a.

Float Data Type

Float is a Data Type to store decimal point values. Generaly, Float Data Type occupies 4 bytes.

Float Data Type Program

#include <stdio.h>
int main()
float a = 8.987654321;
printf("The value of a = %0.9f",a);
return 0;
  • The value of a = 8.987654686


Here float data type store an decimal point value 8.987654686 in variable a. Note that float data types precision is limited up to 6 digit after a decimal point. After six digit some garbage value will be displayed by the compiler. %0.9f represent, Display 9 numbers after decimal point.

Double Data Type

Double is a Data Type to store decimal point values with more accuracy than float. Generaly, Double Data Type occupies 8 bytes.

Double Data Type Program

#include <stdio.h>
int main()
double a = 8.987654321;
printf("The value of a = %lf",a);
return 0;
  • The value of a = 8.987654321


Here double data type store an decimal point value 8.987654321 in variable a with more precision.

Report Us

We may make mistakes(spelling, program bug, typing mistake and etc.), So we have this container to collect mistakes. We highly respect your findings.


We to update you