Talk:C Programming

From Wikibooks, open books for an open world
Latest comment: 2 years ago by DavidCary in topic What standard of C
Jump to navigation Jump to search
  • Started: 11 August 2003‎
  • Size: 60,800 words (15 March 2012; determined from the printed version, so probably actually larger)
  • Recent changes
  • All subpages
  • Headings Case: a mixture of title case and sentence case

Programming:C Contributor style guide and discussion

[edit source]

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)Reply

Perhaps change history section a bit

[edit source]

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

[edit source]

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???

[edit source]

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

[edit source]

(moved to C Programming/Simple Input and Output )


merge the cover page and the table of contents?

[edit source]

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"[1] [2].

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)

Wikibooks:Naming policy

[edit source]

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)Reply

Compilers

[edit source]

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)Reply

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

[edit source]

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 ?

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

--DavidCary (discusscontribs) 06:59, 5 March 2013 (UTC)Reply

String function implementations

[edit source]

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)Reply

Program Flow/Control

[edit source]

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

In addition to

[edit source]

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?

[edit source]

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)Reply

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 (discusscontribs) 18:23, 27 November 2020 (UTC)Reply

Topics

[edit source]

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)Reply

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

Use of the "source lang" tag

[edit source]

I've seen the use of the <source lang="c"> tag in wikipedia in order to achieve source code highlighting and was woundering what was preventing the use of it here ? is a call for a <code> , <pre> etc. tag replacer bot in place ?

I think its a problem of information and history.

I think we shall change little by little to this <source lang="c"> to get a consistent style.--Hoxel 14:12, 15 November 2007 (UTC)Reply

C99 reference

[edit source]

As the WWW is a bit lacking in the "good C99 reference" department, I've decided to start out a section dedicated to it here. Thoughts? Mecanismo (talk) 18:40, 12 February 2008 (UTC)Reply

I noted the same thing as Mecanismo. I have started filling in the gaps, starting with assert.h/assert(). This is my first attempt at wiki-ing, so if anyone has any comments on what I have done so far (especially layout), let me know. Electrobadger (talk) 22:31, 13 June 2008 (UTC)Reply

Something to consider

[edit source]

I just noticed, this book is a bit misleading. If you look at the Programming Bookshelf it says it's 50% completed, but it doesn't say so in any place in the book itself.

Formatting of Examples in the PDF Version

[edit source]

The examples in the PDF version use indented paragraphs rather than tab/space characters, so that when copy-pasted to a text editor you lose the formatting.

For example, the following code:

#include <stdio.h>

int main(void) {
   printf("Hello, world!\n");
   return 0;
}

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:

#include <stdio.h>

int main(void) {
printf("Hello, world!\n");
return 0;
}

How can this be fixed?

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

another freely available C programming book

[edit source]

"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)Reply

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)Reply

Yet another book on C

[edit source]

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 (discusscontribs)

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. --darklama 16:12, 28 January 2011 (UTC)Reply
Link to that book is on this page. That links to this one, where you can find the download link. --Arny (discusscontribs) 01:30, 22 June 2015 (UTC)Reply

Great book

[edit source]

Thanks very much for the clear explanation. Good clarity is rare. I've learnt a lot in a very short time! — Preceding unsigned comment added by Johann.mahne (talkcontribs) before 08:10, 5 February 2012 (UTC)Reply

Completed Status

[edit source]

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 (discusscontribs) 04:34, 26 February 2013 (UTC)Reply

list of standard library header files

[edit source]
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 Category:Book:C Programming/Templates).
--DavidCary (discusscontribs) 06:45, 5 March 2013 (UTC)Reply

What you need before you can program

[edit source]

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

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 (discusscontribs) 16:42, 27 May 2016 (UTC)Reply

merge

[edit source]

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 (discusscontribs) 17:11, 27 May 2016 (UTC)Reply

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

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 (discusscontribs) 17:04, 8 October 2016 (UTC)Reply

E-reader PDF won't download or open correctly

[edit source]

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 (discusscontribs) 01:20, 5 August 2016 (UTC)Reply

Personally I can open this book PDF with Firefox. JackPotte (discusscontribs) 06:51, 5 August 2016 (UTC)Reply

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 (discusscontribs) 17:01, 5 August 2016 (UTC)Reply

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 (discusscontribs) 05:16, 6 August 2016 (UTC)Reply

Major Restructure

[edit source]

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 (discusscontribs) 10:52, 26 May 2017 (UTC)Reply

New PDF Version

[edit source]

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

@Dirk Hünniger: Your new pdf seems to have duplicated the old TOC structure from the print version, which I updated. --Strange quark (discusscontribs) 10:35, 28 December 2017 (UTC)Reply
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)Reply

What standard of C

[edit source]

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

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 (discusscontribs) 01:58, 11 December 2021 (UTC)Reply