13 Replies Latest reply: Jun 23, 2012 6:27 AM by alhaynes
mark133 Level 1 (65 points)

I'm trying to find a good, thorough, C syntax reference to help save time on the mistakes with the details of the syntax.


Are there any suggestions more efficient and orderly than simply going around fumbling with bits and pieces of code and learning the details through mistakes?

  • X423424X Level 6 (14,215 points)

    My favorite book, way back when, was the following:


    C: A Reference Manual

    By Samuel P. Harbison, Guy L. Steele

    Published Feb 21, 2002 by Prentice Hall.

  • mark133 Level 1 (65 points)

    Thanks for that. With your term of 'reference manual' I was also able to find this




    But it's for C 89, I think?


    I don't know the difference between C89 and C99, if there is much? Or is C99 also out dated?

  • mark133 Level 1 (65 points)

    That site also didn't have a few of the specific items I was looking for, like:


    !=null      does the '!' simply mean 'not'? Can that be used in any expression?



    %s, %d, %i    in a string, what do these mean, precisely? Is a slash required before or after the quotes?



    const char *Name     does the '*' define the variable as a string, or is the '*' only used for manual notation?

  • X423424X Level 6 (14,215 points)

    You are asking some very basic C questions where I think a book like what I mentioned would be of more use to you than just a language specification.


    You don't want C89, C99, just C.  Preferably ANSI C.

  • steve359 Level 6 (13,282 points)

    With respect to X423424X ...


    I have carried "The C Programming Language", written first by Brian Kernighan and Dennis Ritchie (modeied/updated many times since) ever since 1988.  250 pages of "very good reference, not the best teacher though".  Prentice Hall, ISBN 0-13-110362-8.


    But then learning is a very individual thing, with individual responses to the same book.

  • X423424X Level 6 (14,215 points)

    If you want a cut and dry reference manual then that would be the definitive ISO standard:


    Programming language - C (ISO/IEC 9899:1990)




    This is definitely not for learning the language.  It's pure reference.


    And Steve359 is right.  It's been a lot of years since I had to pull those books off my bookshelf and the old Kernighan and Richie C book was the book I believe I originally used to learn C.  Forgot all about it. [Hmm, under a bright light I think the edges of mine are starting to turn yellow.]

  • Keith Barkley Level 5 (6,040 points)

    Either Harbison and Steele or K&R would be fine for you. One of the best online references is:



    K&R - Kernigham and Richie "The C Programming Language" would probably be best.

  • Keith Barkley Level 5 (6,040 points)

    And to answer your questions:

    ! is the C logical not operator. It can be used in any expression, but gives strange results in an arithmetic context!


    However, != is a single operator, the not equals.


    The %c et al mean *nothing* in a general C string, they only work in a "format specifier" context like printf(). They tell printf() what arguments to expect and how to print them. %s says that the argument is a '\0' terminated string.


    I don't know what you mean by "slash before or after the quotes" a \" in a string says to print a " and not terminate the string

  • steve359 Level 6 (13,282 points)

    const char *Name ...


    "char *" means pointer to a character. C is all about pointers and memory referencing.  A quite necessary topic.


    As to "const char *Name" ... refresh my memory forum ... is that a "constant pointer to a char" or a "pointer to a constant (unchangin) char"?  Or is that particular problem just with C++?

  • Keith Barkley Level 5 (6,040 points)
  • mark133 Level 1 (65 points)

    That could just have been my mistake. I wasn't copying and pasting what I didn't know, just typing from my own vague, confused memory.


    Those are some really great replies and I look forward to looking up the outstanding references.

  • steve359 Level 6 (13,282 points)

    Jst for the record ... the K&R book I carry around is stil in print ... about $45 at Amazon for the latest (they tweak it as needed, but have not replaced it wholesale) version.

  • alhaynes Level 1 (0 points)

    A pdf of the 1988 manual is available online (somewhere).I don't remember where I stumbled upon it, but it came up as I was (frantically) googling for C info a few months ago.