Pragma directive in c


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 simply ignore that pragma statement without showing any error or warning message and execute the whole program assuming this pragma statement is not present. For example  suppose there is any pragma directive is #pragma world .

#include<stdio.h>
#pragma world
int main(){
    printf("C is powerful language ");
    return 0;
}

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

List of pragma directives in turbo c 3.0:

1. #pragma startup
2. #pragma exit
3. #pragma warn
4. #pragma option
5. #pragma inline
6. #pragma argsused
7. #pragma hdrfile
8. #pragma hdrstop

4 comments:

AMEERUL_MANIT said...

can you descibe each after 3rd???

rahul tripathi said...

what is the use of this

Balu Naik said...
This comment has been removed by the author.
Balu Naik said...
This comment has been removed by the author.