Saturday, 22 January 2011

Preprocessor operators in c





There are two operators in c preprocessor:



1. # : This operator is called stringizing operator which convert any argument in the macro function in the string. So we can say pound sign # is string maker. Example




#include

#define string(s) #s

int main(){

    char str[15]= string(World is our );

    printf("%s",str);

    return 0;

}




Output: World is our



Explanation :

No comments:

Post a Comment