Search code examples
cqualifiers

What are Qualifiers in the C language?


I am reading some text at this url:

https://cs.senecac.on.ca/~btp100/pages/content/varia_p.html

In the section 'Qualifiers', they say:

"We can qualify the int type to be sure that it contains a minimum number of bits" .... A short contains at least 16 bits: ....

I don't understand this, what does "qualify the int type" mean and why "A short contains at least 16 bits".

Can anybody elaborate on this please? Thanks all.


Solution

  • You can use Qualifiers to indicate what size of number you want to store inside your int. Think the exact size varies by implementation of C, but typically it's as follows.

    short int a; // 16 bits, range -32,768 to 32,767

    unsigned short int b; // 16 bits, range 0 to 65,535

    unsigned int c; // 32 bits, range 0 to 4,294,967,295

    int d; // 32 bits, range -2,147,483,648 to 2,147,483,647

    long int d; // 32 bits, range -2,147,483,648 to 2,147,483,647 (minimum requirement, can be higher on 64bit systems)