
Ask HN: What is the correct method to teach C in a university? - philonoist
My university in India has somewhat rigid rule to teach C and it is compulsory. The course spreads over 3 hours a week and spans through 4 months.
======
otras
CS50, Harvard's introductory CS class, introduces students to programming with
C. I took the online version in 2016, and I greatly enjoyed the way it was
presented. I'm not in the best position to compare and contrast teaching
methods, as I've only taken the single class on C, but if you have the time I
would highly recommend seeing how they do it.

You can access their lectures, notes, problem sets, slides, and other material
for free on their course website [0] and on edX [1]. A warning in advance
before you click the course website link though! It's currently Halloween, and
the page features an autoplaying scream sound. You've been warned!

[0]:
[https://cs50.harvard.edu/2018/fall/](https://cs50.harvard.edu/2018/fall/)

[1]: [https://www.edx.org/course/cs50s-introduction-computer-
scien...](https://www.edx.org/course/cs50s-introduction-computer-science-
harvardx-cs50x)

------
sloaken
First question is why? Are you making systems programmers? Are you trying to
ensure they have a deep understanding of how a computer works?

Personally I would recommend teaching some simple type-less language first.
This will be their 'Crutch' language, used to test out simple algorithms.

Then I would teach them assembly language. Make sure they call subroutines and
use pointers, but on a simple level. Like sort an array of strings.

Then I would teach them the C and show how it directly and easily translates
to assembly. Having done assembly they should have an easier time of pointers.
As we all know, pointers is what makes the new C programmers cry. Well that
and freeing the same space twice.

------
increment_i
I suppose the main snag will be pointers. The approach that worked for me was
the holistic approach of using C as a way of controlling the machine's memory
itself.

In my view, C really only makes sense in the context of manipulating data in
and out of the heap and the stack. So once you're past basic syntax, I guess
start there: the heap and the stack. When you grasp that, I feel like you can
stand on solid fundamentals on how computers work going forward.

------
kazinator
The correct method to teach C must be rooted in specification of behavior.

Behavior that is _observed_ in a C program is not necessarily one that is
_required_. If that behavior is required at all, it might only be required by
the platform or implementation, not by the language.

Students should not be discouraged from learning by experimenting, but they
have to take the results with a grain of salt. Question, research and discuss
everything.

