संदीप गुप्ता Sandeep Gupta - My nerdy side

17.3.06

c/c++

Here is a program to print 'c' if the program is compiled with C compiler and 'c++' if it is compiled with c++ compiler.

The file can be named as .c and on tru64 machine cxx's -x cxx option needs to be used to compile it as c++.

#include 
int main()
{
int i=0;
#ifdef __cplusplus
printf("c++");
#else
printf("c");
#endif
return 0;
}

0 Comments:

Post a Comment

<< Home