Talk:C Programming


 * /Q&A Archive/
 * /Q&A Archive/

About

 * Started: 11 August 2003‎
 * Size: 60,800 words (15 March 2012; determined from the printed version, so probably actually larger)
 * Headings Case: a mixture of title case and sentence case
 * Headings Case: a mixture of title case and sentence case
 * Headings Case: a mixture of title case and sentence case

Programming:C Contributor style guide and discussion
I've trimmed the outline here. Specific details such as if, for statements and so on should go under their parent article. Dysprosia 08:56, 20 Aug 2003 (UTC)

I think lots of work needs to be done in reorganizing the Beginning C section. The variables section needs to be reorganized quite a bit, and I think the compilation page should go away. Thunderbunny 22:53, 13 Dec 2003 (UTC)


 * Where is the pointer and functions? I suggest we move the content in this cover to Programming:History of C. the fmt of this book is quite different from other books. --Yacht (talk)Q 02:42, 21 Feb 2004 (UTC)


 * Pointers and relationship to arrays Dysprosia 03:20, 21 Feb 2004 (UTC)


 * something about macro definition and substitution? --Yacht (talk)Q 02:52, 23 Feb 2004 (UTC)


 * You can use #define for function/macro definitions, but they're rather evil. I'd use #define only for constants. Dysprosia 03:27, 23 Feb 2004 (UTC)


 * i meant do we need a separated chapter for that? --Yacht 17:01, 28 Feb 2004 (UTC)

Pages should be limited to the context of the title, for example the "Programming:C" page should be restricted to the language itself: the history of the language is appropriate, the tutorial is not. Anything that isn't universally "the C language" should be relocated to the appropriate page.

Additionally, C programs are not limited to unix environments.

--Eibwen 04:15, 25 Sep 2004 (UTC)

Hi there,

Let me start by saying that from what I have seen so far, I like this book very much. So much so, that I recommended it be featured on the front page after some polishing, as an example of what a textbook should look like.

However, there is one thing that seems to be severely lacking to me. In the introduction of this book, it is written: "This book is intended to teach C programming, from beginning to advanced." This would seem to indicate to me that this is a book that teaches you how to program in C. However, from what I have seen so far, this is more like a reference manual for the C language. What's lacking is a C tutorial, something that explains concepts to me by letting me code small programs, and compile and test them. Is this intentional?

I am not a coder myself, I cannot fill in perceived gaps in this manual, I am afraid.--Branko 17:26, 27 Mar 2004 (UTC)


 * Perhaps there should be seperate tutorial and reference books?

I completely agree, and would like to add that some kind of assumptions need to be made about the user's level of programming experience and then standardised throughout the book. I found it difficult to understand what I was expected to know reading this book. Though it supposedly takes you "from beginning to advanced", I found that each chapter appears completely disconnected and independant of every other chapter. While some assume you don't know things that have already been covered, others seem far advanced to any previous chapters (e.g. the libraries section, which utterly confused me after a somewhat pleasent introduction to functions in C).


 * Ok, I think this should be a high priority issue as the book in its present state is half unusable to both beginners and advanced coders. How about divide it to two parts: I Basics (intro to programming languages in general), II Advanced (C-specific topics and other advanced stuff: scopes, idioms, nothing platform-dependent though), III Appendix (C-keywords, precedence tables, ASCII charts etc.)? Epikuros 13:24, 27 October 2006 (UTC)

Perhaps change history section a bit
I think the history section is slightly misleading, slightly innacurate and slightly inappropriate.

- The advent of the solid state era at Bell Labs is irrelevant to the software research done there. Computing (FotranAlgol etc) was developed on thermionic equipment, and the advent of C was on machines decades later. There is no direct link between the two. More important and germane would be the research done there by Shannon on encoding and information theory around 1950. C could have happened without solid satate, but not without information theory.

- The lineage from Fortran is innacurate. Algol weas created as a reaction to the multiplicity Fortran and all of the other high level languages at the time (there were many). Fortran was the most popular, but this "begat" is misleading. In the letter from the GAMM committee on the higher level lanugage, written after a tour of America in 1957: "We have endeavored from the beginning to avoid the possibility of deviations from existing earlier proposals (Rutishauser 1951, FORTRAN, partly also PACT). Guided by tbe news and reports that Bauer and Bottenbruch have brought back from America, we have decided that our hitherto existing proposals also largely agree structurally with Perlis' IT language and the Remington-Rand Math-Matic. This agreement is most striking with Math-Matic, the most recent of the listed proposals." (cited in Bemer 1969)

This passage is important not only because of its explicit distancing from Fortran as a sole solution, but also of its mention of the many other language systems - including some excellent Eurpoean ones - that existed at the time.

- it is inappropriate in that ignores the rich tradition of programming language research being done at Bell in the period - notable languages are

1955 Wolontis-Bell Interpreter

1955 L3

1958 L2

1959 Bell SAP

1959 Macro SAP

1961 Music

1962 SNOBOL

1962 SCL

1963 ALPAKA

1963 ALPAK

1963 L6

1963 ALTRAN

1964 Process III

1965 OEDIPUS

1966 EPL

1966 ALPAKB

1966 VPRPAK

1966 IBMAP

1966 BEFAP

1967 MULTILANG

1967 GRIN

1967 AMPL

1968 B-LINE

1969 FASE

1970 SWAP

1971 BELL-CODE

All of which were in their way influential on the development of C. In particular, the tradition of macro-languages and macro-extensions to languages at Bell certainly was vital to the style and design of C. (Can you imagine C without the preprocessor?)

Resources added
Added a resources link to the Pelles C page and Open Source page I created - Hope that is appropriate 82.69.58.117 06:17, 25 Sep 2004 (UTC)

Why are thereTWO tables of contents???
I don't understand. In the table of contents at the top of the page, there is a link halfway down to another table of contents with a nested subtree of data. IMO, this adds unneeded complexity. I want to flatten this out and just have one table of contents at the top, like 99% of the other texts on this site.

Any objections? If not, I will make the change next weekend. --Waxmop 15:49, 23 Oct 2004 (UTC)

I Added the {Free,Net,Open,Darwin,DragonFly}BSD information about they have the gcc on there systems.

--Luís Vitório Cargnini 14:19 (-03:00 GMT, -03:00 UTC) March 21, 2005.

A beginner learning C
(moved to C Programming/Simple Input and Output )

merge the cover page and the table of contents?
Someone recently split apart the cover page and the table of contents ( Programming:C and ). I find it reminiscent of "splash screens". Many people recommend *not* using "splash screens".

Do those objections *not* apply to wikibooks, or should we merge the cover page and the table of contents?


 * Hi, I'm the bastard that moved everything around :-). You raise a good point though, I absolutley hate splash screens on most websites. That being said I think the rules are a little different for books. As of right now the cover does suck though. So if we do decide to keep it a nifty graphic or something would be need to be added. But if you really think the pages should be merged than I'm all for it. Just as long as the first page isn't like what it was before I made my changes. That page was disorganized, had two tables of contents, and looked more like a long essay than a well organized online book. --Astone42 13:09, 25 Jun 2005 (UTC)

Naming policy
You might want to consider the WB:NP. You current naming convention is depreciated and has several disadvantages - like it has no navigational links. Also you worthy effort is neiter considered a book nor a section inside a book. See wikistats which implements an exstensive book and section detector.

--Krischik T 07:15, 11 October 2005 (UTC)

Compilers
Just a logical question here--Wouldn't it be better to teach C by standardizing a single compiler across platforms? We can be more in-depth in how things work, for example, if everyone uses GCC (either by means of direct install or MinGW). Blank 14:11, 14 February 2006 (UTC)

Allow me to quote the FAQ:


 * Many beginners fail to appreciate that C and C++ are used on a
 * number of platforms, and that what works with a particular compiler
 * is not necessarily going to work with another, even on the same
 * platform. It is important that a learner be clear about the
 * differences between programming in standard C or C++, and
 * programming using platform- and compiler-specific extensions. In
 * the long run, this approach - that of separating the idea of
 * "language" and "platform" - leads to a better understanding of both
 * the language and the platform. It is generally accepted that the
 * sooner this is appreciated by the learner, the better.
 * -- the C FAQ

Does that answer your question?

other wiki that discuss the C programming language
Is there a better place to mention other wiki that discuss the C programming language ? Is " http://wikibooks.org/wiki/C_Programming " the appropriate link to use to get those other wiki to link back to the beginning of this book ?
 * clc-wiki http://clc-wiki.net/ "computers.languages.c"
 * the original wiki http://c2.com/cgi/wiki?CeeIdioms
 * Pelles C
 * Wikipedia: "C programming language"
 * Wikipedia: "C syntax"

-- DavidCary --70.189.73.224 03:11, 31 July 2006 (UTC)


 * the Pelles C Wiki
 * A wiki about C programming standards
 * The C Programming Tips and Tricks Wiki.

--DavidCary (discuss • contribs) 06:59, 5 March 2013 (UTC)

String function implementations
Does anyone have any objections to me re-writing some of the string function implementations? Frankly including meaning-less variable names, along with the ternary conditional operator, is not the way to instruct others on C programming or on how the string functions work. AmitDeshwar 08:01, 11 February 2007 (UTC)

Program Flow/Control
Why is the Control page called "Program Flow" in the table of contents, but "Control" elsewhere? --Kpengboy 03:15, 4 May 2007 (UTC)Kpengboy

In addition to
Few days ago I started writing C Programming book in Estonian and i would like to link all the pages here. So could someone write "Standard language rules", so that I could verify what i have written and link it here?

It should contain at least:
 * syntax, something like:
 * C has free design
 * Code segment is ended by ";"
 * C differs capitals
 * C needs the code segment to be defined or valuated before use, and also how it differs from
 * recursion
 * linked list data structure
 * Parts of code, where to write them and short description what thy are, something like
 * comments on the written program
 * pragma/include directives
 * define directives
 * structures
 * global variables
 * prototypes
 * main function (with short overview how data is passed & how value differs from reference)
 * other functions
 * Unwritten rules (or links to them, like Element of style)

Exercises, anyone?
I think there should be some exercises at the end of each lesson - so that the reader can practice. # Brandon Johnsonn 12:43, 18 June 2007 (UTC)

I agree with this strongly; the current format of dumping 100 exercises at the end of the first several sections is both overwhelming and, without solutions, of limited use to the student. Inclusion of a few appropriate exercises, well explained with solutions, at the end of each lesson would significantly increase the utility of this book. Meatnordrink (discuss • contribs) 18:23, 27 November 2020 (UTC)

Topics
It seems to me that the topics in this ebook are drifting around. Is this book going to teach C programming language or the standard C library? In my experience of teaching C it is best to start as simple as possible and cover the language and include only the bare minimum library calls, like printf, scanf, getc, etc.

I would suggest to start very slow with a general introduction then follow though with more specific topics such as types and variables, operators and expressions, flow control, functions, pointers and arrays, structures, and IO. There is defiantly a need for a book on the standard library, more advanced topics such as macros, error handling, and whatnot, but not in an introductory text.

Remember that people will be reading this book because they don't know C and most likely very little about programming. Jumping into advanced topics like error handling before you even cover what a variable will not get the response you are after.

I have had the most success when topics are covered in this order: introduction, types and variables, operators and expressions, flow control, functions, pointers and arrays, structures, and IO. Topics should be brief and general without getting to deep to avoid overloading the student. All other material should be moved to a new text or placed in an intermediate or advanced section of the book.

What does everyone else think? I can see that this book has been pretty slow so if I don't get any responses within a few days I will restructure the beginning C section and start hacking away... I would rather have some community involvement with this rather then just a me thing. --Karl McClendon 02:37, 6 September 2007 (UTC)

I agree and would like to help if you are still on it -- Nefthy 11:16, 16 October 2007 (UTC)

Use of the "source lang" tag
I've seen the use of the

when copied from the on-line or print version, pastes OK into a text editor.

However, if you copy-paste from the PDF file, you get:

How can this be fixed?

--Rickjpelleg (talk) 19:43, 27 November 2008 (UTC)

another freely available C programming book
"The C Book, second edition by Mike Banahan, Declan Brady and Mark Doran, originally published by Addison Wesley in 1991. This version is made freely available." http://publications.gbdirect.co.uk/c_book/

Is there anything we need to do before copying-and-pasting that entire book into this Wikibook? --DavidCary (talk) 02:38, 22 March 2009 (UTC)


 * I had noticed it before but thought that it was somehow problematic since it would involve checking that it was up-to-date and the license gives the impression that a 3rd party is licensing a work that it doesn't hold the rights of "this online version and derived works is copyright Mike Banahan".
 * The license text is a bit convoluted and there wouldn't be any problem if the license was granted directly by Mike Banahan, and "The online version was prepared with the assistance of some Perl scripts written by Mike Banahan..." doesn't directly imply the granting of those rights.
 * You can try to get a clearer statement from the site (it has that content up from sometime now) or from Mike Banahan, I have taken similar steps successfully before.   --Panic (talk) 03:07, 22 March 2009 (UTC)

Yet another book on C
Ever heard of "Think Pyhton"? There's a book with the same structure called "Think C", and because it is published by Green Tea press it's under the GNU Free Document License. It would be great if we could add it here. —Preceding unsigned comment added by 148.201.1.205 (discuss • contribs)


 * That is a good idea. I couldn't locate the book on the Green Tea Press website though. Also the publisher or authors would need to grant permission for licensing under CC-BY-SA too. --dark lama  16:12, 28 January 2011 (UTC)


 * Link to that book is on this page. That links to this one, where you can find the download link. --Arny (discuss • contribs) 01:30, 22 June 2015 (UTC)

Great book
Thanks very much for the clear explanation. Good clarity is rare. I've learnt a lot in a very short time!

Completed Status
In comparison to some of the other featured and "completed" books (Ada Programming, Python, Haskell, Scheme in 48 Hours), this one in particular seems to be lacking significantly. It could use a large amount of restructuring, a consistent style across the book, full coverage of topics, exercises, standardizing the experience level of the reader across the book, etc. etc. Not that it isn't a great book so far, but I think it could be much more with some more work. Thoughts on removing the completed tag and beginning a restructure? CharmlessCoin (discuss • contribs) 04:34, 26 February 2013 (UTC)

list of standard library header files

 * Which section of this book is the best for the list of standard library header files?
 * I see a list of standard library header files at C Programming/Reference Tables, C_Programming/Standard_libraries, C Programming/C Reference/List of C functions, and C Programming/C Reference.
 * If, for pedagogical reasons, a student reading through a printed copy of this book really needs that list repeated in various sections,
 * would it be OK if someone made a template for that list?
 * (Templates for text that is repeated in various parts of this book are listed at /Templates).
 * --DavidCary (discuss • contribs) 06:45, 5 March 2013 (UTC)

What you need before you can program
While I think this book should emphasize writing portable C programs that can run on nearly every computer, I see that many computers apparently don't have a C compiler installed, and it is not obvious to the beginners reading this book (our target audience) which C compiler to choose and how to install it.

I think it's a little misleading that the "C Programming/Using a Compiler" page doesn't say anything about using a compiler -- apparently that is covered in "C Programming/A taste of C", "C Programming/Compiling", and later sections of the book.

Would it be more helpful to our target audience to take all the step-by-step operating-system-specific details at "C Programming/What you need before you can learn" and "C Programming/Using a Compiler" pages, and move them to a dedicated page for each operating system? Perhaps
 * "C Programming/What you need before you can program on Linux"
 * "C Programming/What you need before you can program on Mac OS X"
 * "C Programming/What you need before you can program on Windows"
 * "C Programming/What you need before you can program on BSD"

How can we make it obvious to beginners that these operating-system-specific details are completely irrelevant to (portable) C programming, and it's safe to skip over those details? Should we stick those details in an appendix, rather than near the beginning of the book? --DavidCary (discuss • contribs) 16:42, 27 May 2016 (UTC)

merge
My understanding from reading "C Programming/What you need before you can learn" is that this "C Programming" book has a topic of standard C programming and a target audience of beginners who have never programmed before. As far as I can tell, Beginning C, "C Programming", and Fundamentals of C Programming have the same topic and the same target audience, and so should be merged into one book, in accordance with Using Wikibooks/Contributing To An Existing Wikibook.

If they actually have a different topic or a different target audience or both, please edit the books to make that more clear. Otherwise, I suggest merging all these books into the "C Programming" book. --DavidCary (discuss • contribs) 17:11, 27 May 2016 (UTC)

If the content belongs in this book, merge away. 2601:8B:C301:EFF3:28C4:6E8A:E0E6:98F4 (discuss) 01:40, 18 June 2016 (UTC)

I think that the Fundamentals book has useful stuff, but is overal redundant with this C Programming book so I am going to have a run at a merge .. if that goes well i will take a look at "Beginning C". From my first look at it the tutorial style is not so amenable to merging (IMHO). VulcanWikiEdit (discuss • contribs) 17:04, 8 October 2016 (UTC)

E-reader PDF won't download or open correctly
Hello there,

I have been trying to d/l the e-reader version to view on my tablet... but the link will not save correctly or open up in Adobe Reader.

Is this a known issue, or something new?

Thanks,

Monte Memilanuk (discuss • contribs) 01:20, 5 August 2016 (UTC)
 * Personally I can open this book PDF with Firefox. JackPotte (discuss • contribs) 06:51, 5 August 2016 (UTC)

Dear Memilanuk,

you have to click on the image in the ebook reader pdf version in order to open the pdf file, it in deed does not open the pdf before you click on the image on the file description page. A possible solution is that we modify our template here, but I am to lazy to do so. Yours --Dirk Hünniger (discuss • contribs) 17:01, 5 August 2016 (UTC)

Well... hmm. I'm using Google Chrome on my Samsung Galaxy Tab S 8.4... if I tap on the link (single left click) it tries to open the file in Adobe Acrobat Reader. If I tap & hold (equivalent to right-click) on the link, I get the contextual menu. I select "Save link", which it then tries to do. The resulting file is not recognized by the browser as a PDF, as it offers other programs to try and open it (besides the normal pdf viewers installed on here). If I try opening the file from Adobe Reader, I get an error message as well.

I tried opening the link in a new tab, which I guess is what you were talking about. There is a link there to the e-reader file... but the formatting appears rather... weird. Some pages are rotated one way, some another. The text won't re-flow. And the pages appear to run backwards as well.

Guess I'll stick with the regular version. Memilanuk (discuss • contribs) 05:16, 6 August 2016 (UTC)

Major Restructure
I made a big restructure at reference section, here is its current form:
 * All header files are at the root of the book, because I think name collisions are not possible (all of them are postfixed with .h)
 * The functions are contained within their corresponding header file

Are there any objections? I think this is the simplest structure with minimal name collisions. --Strange quark (discuss • contribs) 10:52, 26 May 2017 (UTC)

New PDF Version
I made a new PDF version. I am eager to hear about any bugs you find in it. Yours Dirk Hünniger (discuss • contribs) 21:11, 15 December 2017 (UTC)


 * Your new pdf seems to have duplicated the old TOC structure from the print version, which I updated. --Strange quark (discuss • contribs) 10:35, 28 December 2017 (UTC)
 * Hello, I tried to compile the old source embedded in the C_Programming.pdf file with no success due to deprecated and obsolete packages (from MikTeX). Is there any fix to this?
 * P.s. I'm new to using wikipedia this way, I'm only using it when researching, etc.. Please bear with me.
 * That's all, thank you. 182.255.42.32 (discuss) 09:49, 19 July 2021 (UTC)

What standard of C
What standard of C is this wikibook about? Simulator-master (discuss • contribs) 10:44, 12 January 2021 (UTC)


 * I see that C Programming/Standard library reference has some information about ANSI C (C89), ISO C (C90), ISO C (C94/C95), ISO C (C99), ISO C (C11), and I'm hoping this book continues to be updated to at least mention future versions. (I suspect it doesn't mention C17 merely because C17 doesn't introduce any new language features).
 * I suspect people editing this book will generally test the examples with the default version that comes with their C compiler, which today is usually more-or-less C17 but is expected to switch to more-or-less C23 in a few years.
 * My understanding is most C code in the world, including all the examples in this book, work fine with C99 or later without any special consideration.
 * Simulator-master, What difference does it make? --DavidCary (discuss • contribs) 01:58, 11 December 2021 (UTC)