What are Data Type in C Language ??? with Free Notes

What are Data Type ???

Data Type are like Blue Prints, Which tells us a one variables required how much space and also which values are stored in it. In other words, Data Types are used in the C Programming to specify the kind of data that a variables can store. They decide how much memory is used or allocated to a variable and what kind of values it can hold.

Types of Data Type

Here we will study about three major Data Types which are mostly used,

  1. Integer Data Type
  2. Character Data Type
  3. Floating – Point Data Types

1. Integer Data Type

Here we have Integer Data Type, which is giving permission to store whole numbers. Like Integer – “int” takes 4 bytes of memory space which is responsible to store the whole number. Let’s take Example,

// Integer Data Type
int num = 10;

Here we write “int num = 10;” – Declare and Initialize an Integer variable “num”.

C Language Notes

2. Character Data Type

Character Data Type are gives permission to store characters. Like Character “char” takes 1 byte of memory space. Which is used to store a one character. Let’s take an Example:

// Character Data Type
    char letter = 'A';

Here we write “char letter = ‘A’; – Declare and Initialize an character variable “letter”.

3. Floating-Point Data Type

Floating-Point Data Type is giving permission to store decimal point values. Like Floating-Point “float” takes 4 bytes of memory space. Which is used to store a Floating-Values.

    // Floating-Point Data Type
    float decimal_num = 3.14;

Here we write “decimal_num= 3.14; – Declare and Initialize an Floating-Point variable “decimal_num”.

Example : Data Types

Here is the example of Data Type in C Language,

#include <stdio.h>

int main() {
    // Integer Data Type
    int num = 10;
    
    // Floating-Point Data Type
    float decimal_num = 3.14;
    
    // Character Data Type
    char letter = 'A';
    
    // Printing the values of variables
    printf("Integer Number: %d\n", num);
    printf("Floating-Point Number: %f\n", decimal_num);
    printf("Character: %c\n", letter);
    
    return 0;
}

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top