Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

C syntax reference

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?

iMac

Posted on Jun 20, 2012 10:29 PM

Reply
Question marked as Best reply

Posted on Jun 21, 2012 12:42 AM

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.

13 replies

Jun 21, 2012 9:35 AM in response to mark133

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?

Jun 21, 2012 12:10 PM in response to mark133

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.

Jun 21, 2012 12:31 PM in response to mark133

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


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


http://www.winapi.co.kr/pds/doc/ISO-C-FDIS.1999-04.pdf


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.😟]

Jun 21, 2012 12:45 PM in response to mark133

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

C syntax reference

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.