Playing with data types...

The article provides an overview of data types in C, highlighting primary types such as integers, floating-point numbers, and characters, along with derived types like arrays, pointers, structures, and unions. It also explains the characteristics and range of each data type variant, including short, unsigned, and long integers, as well as float, double, and character variants. Lastly, it touches on the void type, used for functions that do not return a value.

In C, data types are the classifications that specify which type of value a variable can hold. Here's a quick overview:

Primary Data Types

  1. Integer (int): Used to store integer values.

    for ex. 1, -1,3 ,50, etc.

    Integer can store up to 4 bytes.

    • short int: it has the range of -32,768 to 32,767.

    • unsigned short int: it has the range of 0 to 65535

    • unsigned int: it has the range of 0 to 4,294,967,295.

    • long int: it has the range of -2,147,483,648 to -2,147,483,647

    • unsigned long int: it has the range of 0 to 4,294,967,295

  2. Floating Point (float): Used to store decimal numbers. Variants include:

    • float

    • double

    • long double

  3. Character (char): Used to store single characters. Variants include:

    • unsigned char

    • signed char

Derived Data Types

  1. Arrays: A collection of elements of the same type.

  2. Pointers: Variables that store the address of another variable.

  3. Structures (struct): Custom data types that group different types of variables.

Void

  • Void (void): Used to indicate that a function does not return a value.

In later posts we will learn how to use these data types with practical examples. bye for now we will learn about variables in next post stay tuned.