Data Types in C Programming

Data Types

C offers a standard, minimal set of basic data types. Sometimes these are called "primitive" types. A lot of complex data structures can be developed from these basic data types.

The C language defines 4 fundamental data types:

This data types are declared using the keywords char,int,float and double respectively. Typical memory requirements of the basic data types are given below

The size and range of these data types may vary among processor types and compilers. Data type qualifiers modify the behavior of variable type to which they are applied. Data type qualifiers can be classified into two types.

  • 1. size qualifiers
  • 2. sign qualifiers

Size qualifiers:

Size qualifiers alter the size of the basic data types. There are two size qualifiers that can be applied to integer: short and long. The minimum size of short int is 16 bit. The size of int must be greater than or equal to that of a short int. The size of long int must be greater than or equal to a short int. The minimum size of a long int is 32 bits.

Sign qualifiers:

The keywords signed and unsigned are the two sign qualifiers that specify whether a variable can hold both -ve and +ve numbers, or only +ve numbers. These qualifiers can be applied to the data types int and char only. Example: unsigned int I;

The following table shows all valid data type combinations supported by C, along with their minimal ranges and typical memory size.

Example:

Ready to get started?

Ready to embark on your journey into the world of C programming? Our comprehensive course provides the perfect starting point for learners of all levels. With engaging lessons, hands-on exercises, and expert guidance, you'll gain the skills and confidence needed to excel in this fundamental programming language. Let's dive in and unlock the endless possibilities of C programming together!