Page 1 of 1

Author:  mac [ Sat Dec 23, 2017 4:16 am ]
Post subject:  Cprogramming.com-reviews

How great or useful do you guys think of https://www.cprogramming.com as a place to learn how to program along with a supplementary book (like a reference)?

Did anybody else on here really see it or learned from the articles on it before?

I think it's honestly a pretty fun place to learn from and read. Definitely on my bookmarks list. Is there anything I should know about getting tripped up about? I just asked even though this tutorial site is actually pretty trusted as far as I know.

Author:  Solar [ Tue Jan 02, 2018 7:55 am ]
Post subject:  Re: Cprogramming.com-reviews

I had a look at the "C++ tutorial" (which I don't link because I won't do them the favor).

My litmus test for any introduction of C++ is whether it's still teaching C first, which should not be done as C++ is really a language of its own and should be taught as such. (Really. WATCH that video, and look out for C++ material that does it this way instead of teaching you "the wrong way to do it" first.)

This page teaches you C arrays and strings first. "How to access memory with pointers". Really? The thing that is a code smell in and of itself in proper C++? If you have a "new" outside a class constructor and a "delete" outside a class destructor, as a rule of thumb, you're doing something wrong. (And usually even then.)

The tutorial then goes on and teaches you how to do linked lists manually, with "new" but no "delete" shown in the source, with neither std::deque, std::list, or std::forward_list in sight, and no <algorithm> or iterators in sight either, i.e. none of the stuff that really makes C++ a step beyond C and not just some syntactical suggar sprinkled on top.

At which point I really stopped bothering. This gets a "fail" from me, for the C++ side at least. No better than other mediocre online C++ "introductions". It teaches "C plus something", and from there you would really have to reach and unlearn lots of things showcased in that tutorial to arrive at "proper" C++. One of the main reasons C++ has a reputation for being "hard" and why so much C++ source out there sucks so much -- not the language itself, but that it's still taught as if this were the 80's, and if the class doesn't know C you need to teach that first. Wrong.

Author:  mac [ Wed Jan 03, 2018 1:35 am ]
Post subject:  Re: Cprogramming.com-reviews

Well, Jesus... #-o

And for the record, did you know that I was reading the regular C side of the website articles?

By your thinking, a good primer in C/C++ must be very elusive.

Author:  Solar [ Wed Jan 03, 2018 2:09 am ]
Post subject:  Re: Cprogramming.com-reviews

mac wrote:
By your thinking, a good primer in C/C++ must be very elusive.

First off, you either have a primer for C, or one for C++. The two are very distinct languages.

C is the much simpler language. There are good tutorials for it about. (Edit: But cprogramming.com is not one of them, see my next post...)

A good tutorial for C++ on the other hand... yes, that is rather elusive. I don't think an online "tutorial" style intro is a good thing here. C++ (being much more expansive) basically needs a structured approach and competent editorial review, which you usually won't find written by a single website maintainer offering his work for free, or assembled via wiki. Which leaves books.

(Un)fortunately I have long since passed the stage where I am looking at "C++ intro" style books, and can't make recommendations there. The ones I learned from are ancient by today's standards, and I haven't looked at the newer ones. That is why I linked that SO page with recommendations by others.

Author:  Solar [ Wed Jan 03, 2018 2:46 am ]
Post subject:  Re: Cprogramming.com-reviews

And for the record, I just checked the C tutorial as well.

"Introduction to C", and he tells you that you need to declare variables first before doing anything else. That particular requirement is no longer true since C99...

Next thing, in the subchapter "Reading Input", we get this beauty here:

#include <stdio.h>

int main()
    int this_is_a_number;

    printf( "Please enter a number: " );
    scanf( "%d", &this_is_a_number );
    printf( "You entered %d", this_is_a_number );
    return 0;

Well, let's see. The gorgeously ugly variable name and using printf() where puts() would do aside:

  • He uses scanf() to read user input, which is not a good idea to begin with. (Prefer fgets() and in-memory parsing of the whole input line using e.g. strtol(), which tells you exactly how far it parsed, handles too-large values gracefully, enables you to give the whole input line in error messages etc. etc.)
  • He does not check the return code of scanf().
  • This makes the following printf() undefined behaviour if you didn't input a number.
  • printf() doesn't end the line with \n. (Mostly cosmetic, but still.)
  • As the \n you entered after your number is not read and remains in the input buffer, the getchar() won't hold the execution as intended, the program exits immediately.

So, sorry, fail, toxic, find another resource. This is the kind of tutorial that makes for really bad StackOverflow questions ("but I did follow the instructions!"). ;-)

Author:  glauxosdever [ Wed Jan 03, 2018 6:54 am ]
Post subject:  Re: Cprogramming.com-reviews


I'm a first-year student since October and we are doing C. I've had already quite a lot of disagreements about several topics. I don't know if I'm entirely reasonable here, but I'll say it anyway.

  • They mentioned that C99 exists as a newer version of the standard, but not C11.
  • They said "int f1() { ... }" is equivalent to "int f1(void) { ... }". The former however takes an unspecified number of arguments, while the latter takes no arguments.
  • As an example, they defined an "int f2(void) { ... }" function and, probably to simplify things, they said that "printf(f2());" will print the return value of f2(). I wonder if there was anyone who tried to do that later and got a segfault.
  • We are using scanf() for user input and we've never learned to check the return value.
  • They showed us "for (int i = 0; i < 10; i++)", but the IDEs (DevC++ BTW) in lab's computers are in C89 mode.
    • Funny story, we had an assignment about a month later. I wrote it using C99/C11. The person who examined us (the one of the lab teachers) knew my code was correct, so she tried to hack it a bit, so it worked with C89. I told her "better compile the code as C99 or C11 instead" and she didn't know how do it. I did it for her by adding a simple gcc option.
  • There have been other assignments too. One of them involved copying exactly the same code over all of the six switch cases we had to define. The current one involves using a multidimensional array of pointers that point to integers, strings and floats (of course excessive casting is unavoidable and I wonder if we will ever learn in the lab to use structs instead).

All of this made me think several times to write a C introduction or book myself, even if I'm not proficient in either C or writing books.


Author:  Solar [ Wed Jan 03, 2018 7:04 am ]
Post subject:  Re: Cprogramming.com-reviews

The problem is that this is exactly the way most of the free online tutorials come into existence...

People who really "grok" a language have usually no interest in writing a beginner's tutorial. Teacher jobs are woefully underpayed compared to employment as a professional developer. Pros are full-time employed, possibly with family and a full life. You either have to pay them for it (books) or have to come across the rare combination of technical knowledge, skill at writing beginner-level introductions (that's a completely different thing from knowing how things work!), and the altruism to really make it happen.

I started down that road, but stopped for a combination of "I can't make this happen properly in my spare time either" and other, unrelated problems.

If you open a Wiki for a beginner's tutorial, most of your audience will be beginners.... problem right there.

As glaux has showcased, there's plenty you can screw up even with "simple" C, especially in that fine margin where C isn't a subset of C++. That the Microsoft compiler (which is what most schools use for some unfathomable reason) still doesn't fully support even C99 AFAIK does not improve things on that front...

C++ is a beast, and requires a skilled beast tamer to feed it to students without them being swallowed up whole. :twisted: (But oh, so worthwhile...)

You might find a good C tutorial online, but I have given up hope for a good, free, "complete" C++ tutorial. And most of the classroom-level teachers, let's face it, are those who couldn't find a place as professionally employed dev's... (As opposed to payed lecturers, which can be very good to downright oh-god brilliant... but expensive.)

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group