What is the difference between qualifiers and data type?

What is the difference between qualifiers and data type?

ยท

2 min read

Table of contents

No heading

No headings in the article.

To know the difference between QUALIFIERS and DATA TYPE first we should know about data type and qualifier.

DATA TYPE- A data type defines a set of values that a variable can store along with a set of operations that can be perform on that variable.

Data type is divided into three types and each are further divided-

main-qimg-bf98395d0638c6c287c32945e94e7ef7-lq.jpeg

QUALIFIER- It qualifies the primary data type. there are five group of qualifier in C.

main-qimg-5dbc461e771cc82f0e3ee1a882b8a1c3-lq.jpeg

We can write all five (one for each group) qualifiers for same data type. If we will not write then it will take its default quantifier. We can write quantifier in any order. We cannot write two qualifier of the same group.

e.g. short unsigned volatile const int a=5; (wrong)

Generally, in data type 2 types of qualifiers are used (mostly) are:

  1. Size qualifier (short and long)
  2. Sign qualifier (Signed and unsigned)

Note: When unsigned qualifier is used the number is always positive and when signed qualifier is used it may be negative or positive.

Now, difference between qualifiers and data type:-

A data type, specifies which type of value a variable has and what kind of mathematical, relational or logical operations can be performed to it. For example, a string is a data type that is used to classify text and an integer is a data type used to classify whole numbers.

Where as, a qualifier is a keyword that is applied to a type, resulting in a qualified type. For example, const int is a qualified type representing a constant integer, while int is the corresponding unqualified type, simply an integer.

Thank You for reading :)

Happy Learning & Coding :)

ย