Modifiers of variable in c

Possible modifiers with given data type in c

We cannot use all modifiers with each data types in c. Following table represents permitted or meaningful modifiers which can be used with a particular data type.

Some important points regarding above table:

1. In case of array and pointer, size and sign modifier depends upon which data type you are using in the declaration of array and pointer. Only those SIZE and SIGN modifier are valid which are also valid for that data type. For example:

signed float * p;
short double arr[5];


Above declaration is invalid for c because signed and short modifier is not suitable for float and double data type respectively as shown above table.    

2. In the above table we have used word permitted and meaningful modifier because some modifier has permitted from only compilation point of view i.e. but compiler is not showing any error but it is meaning less statement of c. For example:

short float f;
long float f;
short double d;
void const display();
int static far i;
char interrupt c;

3. We can use pascal and cdecl modifier with primitive data type, pointer and array only for naming convention.  

Question: Consider the following c program:

char c;
int display();
int main(){
    int i;
    return 0;
}


Write down all default modifier of variable c, i and function display, as declared in the above c code.

Answer:
All default modifier of variable: c



Equivalent declaration: signed static char c;

All default modifier of variable: i



Equivalent declaration: signed auto int i;


All default modifier of function: display



Equivalent declaration: extern void cdecl near display();
  

Introduction
List of data types
Primitive data types in c
Modifiers of data types in c
List of modifiers in c
Default modifiers of data types in c
Default data of modifiers in c
Rules of using modifiers in c
Possibles modifiers of given data types in c
Size modifier in c
Size of data types in c
Sign modifier in c
Range of data types in c
Easy way to remember limit of data types in c
Const modifiers in c
Pointers modifier in c
Function modifier in c
Interrupt modifier in c
Volatile modifier in c
Fundamental data types in c
Memory representation of char in c
Memory representation of signed char in c
Memory representation of int in c
Memory representation of signed int in c
Memory representation of double in c

No comments: