Data types modifiers in a c programming language


What is modifier?

Modifier are keywords in C language, which by which meaning of basic data type can change. The modifiers specify how much memory should be allocated to the variable.

The modifiers in the c language help in making the primary data types much more specific.

Data types are prefixed with the basic data types to modify the memory allocated to the variable.

For example: we all know that storage space of integer data type is 4 byte for 32-bit processor.

If we want to increase, the range we can use the modifier called long int. space allocated for long int is 8 byte.

If we want to decrease the range then we can use short int, space allocated to short int is 2 byte.

There are four data modifiers for all data types used in c.

Four modifiers are

  • Short
  • long
  • unsigned
  • signed

Short and long modifiers cause an effect on the value range of any given data type and unsigned and signed modifiers present the signed + or – value in any given data type.

Long : long modifier used increase the size of the data type with 2 more bytes. For example we have int data type with size 2 byte then if we are using long with int then it can occupy 4 byte of memory.

Short: short keyword is used to allocate the fixed memory space to the existing data type.

Unsigned: this keyword used make the value of the data to the positive value.

Signed: this keywords accepts both positive or negative value.

Ex: long int, short int

Unsigned int, signed int, etc. are valid data types in c.

Derived data types in c

Derived data types in c are derived out of the fundamental data type.

The derived data type will not create new data types but it would add various new functionalities to the existing one.

Derived data types in c are

*arrays –the array refers to a sequence of a finite number of data items from the same data type sharing one common name.

The declaration of the array is:

Variable type variable name [sequence of elements];

Ex: int A[10];

Here, 10 means this array A can have 10 integer elements.

Ex: char B [10];

This array B can have 10 character elements.

Initialization of array: if an array is described inside a function, the elements will have a garbage value .in the case of static; it is initialized automatically to 0.

Types of arrays:

There are two types of arrays:

  • One-dimensional arrays: a one-dimensional array is a kind of linear involves a single sub-scripting.


Data type arraname[size];

Ex: int a[10];

  • Multi-dimensional array: an array involving two or more subscripts [] [] is known as a multi-dimensional array.

Syntax for two-dimensional array:

Data type arrayname [row_size][column_size];

Ex: int a[4][4];

The syntax for three-dimensional array:

Data type arrayname[size1][size2][size3];

Ex: int a[5][5][5];

Advantages of Array

  • it is a better version of storing the data of the same size and the same type
  • It enables us to collect the number of elements in it.
  • Arrays have a safer cache positioning that improves performance.
  • Arrays can represent multiple data items of the same type using a single name.

Disadvantages of array

  • In an array, it is essential to identify the number of elements that you need to store.
  • It is a static structure. It means that in an array, in an array, it fixes the memory size.
  • When it comes to insertion and deletion, it is a bit difficult because the elements are stored sequentially, and shifting operation is expensive.
  • Functions – a function refers to the self-contained block of single or multiple statements it has its own specified name.

Declaration of function:

Return _type_of function (parameter list)


Function body


Whenever a function does not return values, you must declare it in the form of a function-returning void.


int add ()


Int x=10, y=10,Z;


Return Z;


Types of functions

The c programming language has functions that are

  • User-defined functions –these are the type of functions that we can create using the c programmers so that we can make use of it multiple times. The function reduces the complexity of any big problem.
  • Library functions-these are the functions whose declaration occurs in the header files of c, such as gets (), puts (), scanf ().etc.

Advantages of using functions in c:

  • When we make use of the function then we can easily avoid the rewriting of the same code/logic repeatedly multiple times in any program.
  • The calling of function may appear as many numbers of times as we want in any program.
  • One of the primary achievements of the c functions is reusability.



Leave a Reply

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