Describe #pragma directive of c programming language?

Answer:

Pragma is implementation specific directive i.e. each pragma directive has different implementation rule and use. There are many type of pragma directive and varies from one compiler to another compiler .If compiler does not recognize particular pragma the it ignore the pragma statement without showing any error or warning message and execute the whole program assuming this pragma statement is not present,
e.g. Suppose any arbitrary pragma directive is #pragma world:
  
#pragma world
void main(){
   printf(“C is powerful language “);
}

Output: C is powerful language
Explanation:
Since #pragma world is unknown for Turbo c compiler so it ignore this directive without showing error or warning message and execute the whole program assuming #pragma world statement is not present.

List of pragma directive:

1. #pragma startup
2. #pragma exit
3. #pragma warn
4. #pragma option
5. #pragma inline
6. #pragma argsused
7. #pragma hdrfile
8. #pragma hdrstop
9. #pragma saveregs
Post a Comment