96

I'm looking for the documentation of all the syntax and built-in functions in C, but I can't find any site online which seems like an ultimate official source of standard C knowledge.

Apart from the famous book by Kernighan and Ritchie, isn't there any online C specification? Maybe there is, and I don't know how to find it. Or maybe the problem is that I don't exactly know what I'm looking for.

Auron
  • 13,626
  • 15
  • 47
  • 54
  • 1
    Looks like you need C realizations, not ISO https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.pdf There is no such thing as official C compiler, there are C compilers like GCC, tinyC etc... – Marat Mkhitaryan Jan 02 '20 at 08:41
  • 10
    This was wrongly closed. It is not seeking book recommendations but a canonical source of truth (the specification) about the language. – R.. GitHub STOP HELPING ICE Mar 24 '21 at 17:48
  • @MaratMkhitaryan Nothing in the question suggested it is about "C realizations" or "official C compiler", instead he specifically and explicitly mentioned "official C compiler". – Trần Việt Hoàng Aug 03 '23 at 14:17
  • I did not mention "official C compiler". I was looking for a "official documentation", and the ISO standard is the closest thing to what I was looking for, together with some other resources also linked in the answers. – Auron Aug 07 '23 at 08:58

11 Answers11

42

You can obtain a PDF copy of the C99 standard (ISO/IEC 9899:1999) from ANSI (and other fine standards organizations) for your private use for a modest fee - I believe it was 18 USD when I bought mine. Having that available is invaluable to me. But if you find a copy in public, then it is contraband.

You can find final committee drafts and current working documents of the C (C0x) Standard Committee at the JTC1, SC22, WG14 web site at the Open Standards Organization. (That's Joint Technical Committee 1, Sub-Committee 22, Working Group 14, I believe).

There is also a hardback book 'The C Standard: Incorporating Technical Corrigendum 1' (also including the Rationale) available for a slightly less modest 85 USD or thereabouts.

One of the best books about C is 'C: A Reference Manual' in its fifth edition. However, you asked for 'ultimate official source of standard C knowledge', and the only 'official' such source is the C standard, plus its corrigenda.

See also the material at http://www.coding-guidelines.com/ and http://c0x.coding-guidelines.com/.

OpenCoderX
  • 6,180
  • 7
  • 34
  • 61
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
  • I don't know where you found the C99 Standard for 18 USD. The one I found costs 403 USD which is insanely expensive: http://webstore.ansi.org/RecordDetail.aspx?sku=ISO%2fIEC+9899%3a1999 – Robert Audi Sep 12 '11 at 08:39
  • @Aziz: the timestamp on my copy is December 2002; it appears that the rules have changed. Certainly, a casual (semi-casual) search today came up with a PDF for $403. If that's because they're waiting to release the 2011 standard at a more reasonable rate, well, sort of fine. If that's what they plan to charge for the 2011 standard, they will be making enormously fewer sales. That said, they make their income selling standards. Your best fallback is probably the hardback book, then. – Jonathan Leffler Sep 12 '11 at 14:26
  • C11 can be found at the ANSI webstore for $60 in PDF at http://webstore.ansi.org/RecordDetail.aspx?sku=INCITS%2fISO%2fIEC+9899-2012. – Jonathan Leffler Jun 27 '15 at 04:24
  • 7
    The GNU LIBC documentation is superbly underrated. https://www.gnu.org/software/libc/manual/html_mono/libc.html – steviesh Nov 14 '16 at 17:00
  • There is a draft C11 standard converted to HTML at http://port70.net/~nsz/c/c11/n1570.html; I use it these days when I need to link to the standard. I still prefer to quote directly from my copy of the C11 standard purchased from ANSI. – Jonathan Leffler Jun 26 '18 at 16:43
  • Price and availability from ANSI have changed since 2010. The current standard is C18 and the price is non-negligible (see https://webstore.ansi.org/Standards/ISO/ISOIEC98992018 — price $250 on 2021-05-14). Older versions of the standard are generally no longer available from official sites, though the link to the [C11 standard](http://webstore.ansi.org/RecordDetail.aspx?sku=INCITS%2fISO%2fIEC+9899-2012) still worked and said $60. Search for "ISO/IEC 9899:2018" and you may find a cheaper version from INCITS at $116 — and a radically more expensive version from BSI at $709. – Jonathan Leffler May 14 '21 at 22:05
  • You can also "borrow" a copy of the C standard (I got a copy of C17) from google :P – Cyao Jan 18 '23 at 19:50
22

There is this online website devdocs

They have multiple API documentations which are well organized. It is free and open-source.

For c doc click this link http://devdocs.io/c/

basavaraj_S
  • 1,333
  • 2
  • 12
  • 20
17

The official C99 standard is available for purchase from your national standards body; however, in practice everyone reads the draft with post-1999 corrections/amendments included, which you can download for free:

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf

R.. GitHub STOP HELPING ICE
  • 208,859
  • 35
  • 376
  • 711
8

Strictly speaking, the C standard is not available for free. You need to purchase an electronic copy from http://www.ansi.org/ or http://www.iso.org.

However, you can download a free draft version from the Open Standards Organization's website - this is as good as or better than the official standard itself. It incorporates information from the ISO C99 standard plus three Technical Corrigenda, all of which are official ISO documents.

More info here: http://c-faq.com/ansi/avail.html

AbdullahC
  • 6,649
  • 3
  • 27
  • 43
  • 3
    So, it seems you have to pay if you want to take a look to the standard. I find it ridiculous! >:( However, I wasn't exactly looking for a pure specification, that's ok for lawyers, I was looking for some more user-friendly official documentation. – Auron Nov 20 '10 at 17:16
  • Ask your compiler vendor! C can differ quite much from compiler to compiler! – Falcon Nov 20 '10 at 17:19
  • 3
    @Auron: the specification is the only **official** documentation; however there are numerous non-official documentations that are much more accessible (both financially and linguistically). So if you're asking for an official documentation, as in normative reference, it's the spec; otherwise they're unofficial. – Lie Ryan Nov 20 '10 at 17:22
  • 1
    @Falcon: no, it can't. If it does, it's not C any more. Compilers introduce their own extensions, but the base language is the same in every standard-compliant compiler (and you don't really want to use non-standard-compliant compilers). – Cat Plus Plus Nov 20 '10 at 17:28
  • 4
    @Lie: Have you ever seen an example of such non-official documentation that's not full of platform-specific assumptions, mistakes, and incorrect documentation of corner-case behaviors? I agree lay-person-accessible documentation for the C language would be nice but I question whether it exists... – R.. GitHub STOP HELPING ICE Nov 20 '10 at 17:44
  • @Auron: Please see my updated answer. You can actually download a publicly available version for free. – AbdullahC Nov 20 '10 at 17:46
  • @Piotr Well, obviously you haven't programmed for many platforms yet. – Falcon Nov 20 '10 at 20:06
  • @Falcon: OK then, give me an example where C differs from compiler to compiler. – Cat Plus Plus Nov 20 '10 at 20:29
  • As an example of what I meant, most documentation about C says that `scanf` returns the number of fields read. This is incorrect; it returns the number *written*, which may be fewer if assignment was suppressed with the `*` format modifier. – R.. GitHub STOP HELPING ICE Nov 20 '10 at 21:14
3

Is there something like the official C documentation?

The most official documentation is the ISO standard, to which compilers are written and are expected to interpret correctly.

C99 Standard

Here's the latest Committee draft on the C99 Standard, last updated April 12, 2011:

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf

I'll try to keep it up to date with the latest version as I can.

Kernighan & Ritchie

I also found K&R's text, second edition, here: http://www.ime.usp.br/~pf/Kernighan-Ritchie/C-Programming-Ebook.pdf

However, I'd use the -Wall flag when compiling the examples in the book so that you don't get led too far astray by the age of the text.

Russia Must Remove Putin
  • 374,368
  • 89
  • 403
  • 331
2

You can refer GNU C documentation at https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html

Specifically, this manual aims to document:

  1. The 1989 ANSI C standard, commonly known as “C89”
  2. The 1999 ISO C standard, commonly known as “C99”, to the extent that C99 is implemented by GCC
  3. The current state of GNU extensions to standard C
Aravin
  • 6,605
  • 5
  • 42
  • 58
2

C is an ISO standardised language. Current specification is ISO/IEC 9899:1999 standard a.k.a. C99.

Cat Plus Plus
  • 125,936
  • 27
  • 200
  • 224
1

https://msdn.microsoft.com/en-us/library/fw5abdx6.aspx The "C Language Reference" describes the C programming language as implemented in Microsoft C. The book's organization is based on the ANSI C standard with additional material on the Microsoft extensions to the ANSI C standard.

1

There're various C standard specifications.

See C's history on wikipedia for example.

When we talk about standard C these days, we mostly refer to the ANSI C Standard.

Here's a link to the standard in textform: http://flash-gordon.me.uk/ansi.c.txt

Falcon
  • 3,150
  • 2
  • 24
  • 35
1

If what you want is the documentation for the standard library functions, then P.J. Plauger's "The Standard C Library" http://www.amazon.com/Standard-C-Library-P-J-Plauger/dp/0131315099/ref=sr_1_1?s=books&ie=UTF8&qid=1290273108&sr=1-1 is the best reference. It's got pretty extensive annotation and comentary on the why and how of the standard.

Steven D. Majewski
  • 2,127
  • 15
  • 16
1

Look at The New C Standard: An Economic and Cultural Commentary.

adamo
  • 3,584
  • 1
  • 18
  • 23