Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I know the version of c?

Tags:

c

The "\b" didn't work on my Mac. So I tried to find the reason.

I think that cause of this problem may be the version of C.

Or device could be. If you know it, can you help me? Thank you.

like image 956
햄스터 Avatar asked Apr 16 '16 08:04

햄스터


People also ask

How do I find the version of C?

You can ask to change the compiler default C version used for compiling using the -std= option with gcc and clang , for example: -std=c90 , -std=c99 or -std=c11 . This is probably the only helpful Answer.

What is the current version of C?

C11 is the current and latest standard of the C programming language and, as the name suggests, this standard was adopted in 2011. The formal document describing the C11 standard is called ISO/IEC 9899:2011.

What is the first version of C?

In 1978, Brian Kernighan and Dennis Ritchie published the first edition of The C Programming Language. This book, known to C programmers as "K&R", served for many years as an informal specification of the language. The version of C that it describes is commonly referred to as K&R C.

Which C version is best?

C99 introduced several new features, including inline functions, several new data types (including long long int and a complex type to represent complex numbers), variable-length arrays, support for variadic macros (macros of variable arity) and support for one-line comments beginning with //, as in BCPL or C++.


1 Answers

There are three ISO standard versions of C: C90, C99 and C11. To know which C version your program is running check the:

 __STDC_VERSION__

macro.

  • For C90: the macro is undefined.
  • For C99: the macro is defined with value 199901L.
  • For C11: the macro is defined with value 201112L.

On the other hand if what you want to know is the version not of C but the version of your C compiler, as the other answers suggests, run the compiler with the appropriate option (--version for both gcc and clang for example).

Depending on your compiler it can support different C versions. You can ask to change the compiler default C version used for compiling using the -std= option with gcc and clang, for example: -std=c90, -std=c99 or -std=c11.

like image 102
ouah Avatar answered Oct 12 '22 11:10

ouah