I\'m working on a Linux machine. Is there any system command to find the standard followed by the C compiler I\'m using?
You can also test this in your code using standard macros, for example (originally from sourceforge project of the same name):
#if defined(__STDC__)
# define PREDEF_STANDARD_C_1989
# if defined(__STDC_VERSION__)
# define PREDEF_STANDARD_C_1990
# if (__STDC_VERSION__ >= 199409L)
# define PREDEF_STANDARD_C_1994
# endif
# if (__STDC_VERSION__ >= 199901L)
# define PREDEF_STANDARD_C_1999
# endif
# if (__STDC_VERSION__ >= 201710L)
# define PREDEF_STANDARD_C_2018
# endif
# endif
#endif
If you want to check this from the command line you can pick one (e.g. c89) and check the return value from a minimal program:
echo -e "#ifdef __STDC__\n#error\n#endif"|gcc -xc -c - > /dev/null 2>&1; test $? -eq 0 || echo "c89