r/C_Programming • u/TenureTrackJack • Aug 03 '25
Advice for a new professor teaching C
I'm looking for feedback on my curriculum for an introductory college-level programming course in C. This is aimed primarily at freshmen with little to no coding experience, although experience level tends to vary. This past spring was my first time teaching independently after previously assisting professors with lectures and labs during my graduate program. My approach is heavily project-based, with each lecture paired with a hands-on lab assignment, supplemented by one or two in-class activities and live coding sessions.
Student feedback has been positive overall, but I'm looking to continuously improve and ensure I'm preparing them for future coursework.
Here's the list of topics covered across 16 weeks. This is paired with labs, exams, and midterms/finals with code walkthrough/live coding sections:
- Class Overview, Introduction to Programming, and Hello World
- Introduction to C, Data Types, Variables, and I/O
- Command Line, Compiling Basics, Comments, Debugging Introduction
- Conditionals, Operators, and Expressions (arithmetic, relational, logical)
- Pseudocode, Flowcharts, Boolean Logic
- Functions, Scope, and Introduction to Call Stack
- Loops (While,Do-While, For)
- Strings, String Manipulation, and Arrays
- Structs, Enums, Typedef
- File I/O
- Pointers, Pointer Arithmetic, Arrays and Pointers Relationship, Passing Arrays to Functions
- Dynamic Memory Allocation
- Recursion
- Compilation Pipeline, Creating and Using Header Files, Compiling and Linking Multiple Files, Makefiles, and Compilation Flags
I've intentionally omitted bitwise operations. I think they might be overly advanced for a first programming experience, but I'm open to reconsidering.
Would love to hear thoughts from the community. Students take data structures and algorithms after this course and would eventually move into embedded systems or operating systems.
- Are there topics I might be missing or areas to expand?
- Is the sequence logical and intuitive for beginners?
Any additional thoughts or suggestions would be greatly appreciated!
81
u/skeeto Aug 03 '25
The major shortcoming I've observed is not teaching students to use the effective and widely-available features of their tools. So students spend a lot of time struggling with problems that could have easily been avoided:
-fsanitize=address,undefinedas a matter of course for all testing. Typical coursework is decades behind, and virtually nobody is teaching sanitizers to undergrads. If you're lucky an instructor might mention Valgrind for memory debugging, though it's largely obsolete now.-Wall -Wextraby default. Maybe even-Wconversionto start forming good habits early. It's amazing how many courses never get this far.18
u/Smart_Vegetable_331 Aug 03 '25
Recursion can be taught right after introducing functions and call stack, no need to postpone it so far.
Loops are more basic than functions and call stack, put them earlier.
I don't think strings, should be introduced before pointers and dynamic memory. People will just get confused by char*. The same follows for file I/O.
Bitwise operations are not really that advanced. You can introduce them later-on, maybe in the context of some "tips-and-tricks" session. You may show them how to check number parity, raise numbers to the power of 2, etc..
Just as a suggestion, maybe introduce them to variadic functions and macros at some point? Macros are very powerful when it comes to creating data-structures in C..
34
u/aocregacc Aug 03 '25
the pointers seem a bit late to me, shouldn't they come before strings and file IO?
5
u/MagicWolfEye Aug 03 '25
Everyone will tell you something else, here is my take. I kind of have to teach first semesters Java.
2. Data types: Please keep that (at least for a while) to bool (I mean that doesn't really exist but meh), int and float or double. I don't know how often I hae seen professors showing how big a number can fit into a char, short, int, long signed or unsigned and nobody cares at this stage.
4. Operators: A student will not care about bitwise operators or the difference between &&/& and ||/|.
3. and 14.; my experience with teaching other programming languages is that beginners really just want to know what key makes my program compile and run. "Hey you can enter cryptic compile symbols" or "You can make your life a lot harder, by splitting everything into multiple files that somehow work together, but only if you do everything correct" is not really what they care about.
(I have to admit, I use C day by day and I compile almost everything as single-compilation build and therefore to this day I am very glad that I almost never have to touch anything regarding compiling several files together).
I have very seldom seen beginners using debuggers (yes, I don't understand why either). Mine rather run their programs, don't read the error messages and have no idea why their stuff doesn't run.
5. Pseudocode and flowcharts. "Hey, instead of writing a program, you can now learn how to write something that kind of looks like a program, but you can't do everything with it"
10. Is there really that much to say about FileIO? (also, how do you do that without pointers; pointers definitely has to go before)
7. I would ignore talking about do-while
8. I would put Strings at some point after arrays
You didn't specifically mention switch-case; do you put it to enums or to conditionals
5
u/enzodr Aug 03 '25
I just learned C in a college class. She started right away with pointers, they were mixed in with everything else we learned, and weren’t some special topic.
I found it strange when hearing other people talk about pointers online, and being confused. Or that some people avoid them entirely to reduce confusion. Yes, they can be confusing at times, but they are hugely helpful.
How can you teach arrays, strings, and data types without pointers? I think it’s best to not pretend they don’t exist.
4
u/EliteDonkey77 Aug 04 '25
Realistically, pointers taught well should not be a challenging concept for new learners to grasp. I’d highly recommend putting that before arrays, strings, structs and file I/O. Your students will likely have a much easier time solidifying their understanding of the other topics that use pointers if you just demistify that sooner than later.
2
u/flyingron Aug 03 '25
Traditional flowcharts are rooted in the pre-structured antiquity. I'd omit them. I'd move the stuff in 14 up earlier (like to unit 3) at least to some extent.
You technically can't pass arrays to functions. When you try, they silently get converted to pointers.
6
u/SmokeMuch7356 Aug 03 '25
My usual rant: C is not appropriate for an intro programming class. It expects anyone using it to know exactly what they are doing and to never, ever make a mistake. It was designed for implementing operating systems, not pedagogy, and it shows.
With that out of the way...
I'd move up the introduction to pointers, ideally with the lesson on functions since that's the first major use case for pointers most people encounter. Pointers really are fundamental to programming in C, but they always get deferred to late in the curriculum as an "advanced" feature when they're not. I'd also introduce arrays with other data types early on.
2
u/[deleted] Aug 03 '25
I'm a new learner myself, so i don't know if the perspective is valid and useful.
Seacord and Gustedt basically hit pointers and memory management after ide recommendations, which I felt was very high impact when starting from zero.
CS50 abstracts away character arrays, pointers, memory location, and safe input until half way through the course, which I found a bit frustrating while solving problem sets.
I think C may be tricky to find a happy medium teaching approach, because students want to be able to write simple interactive programs right away, but to do so, you kinda need to throw the kitchen sink at them.
2
u/D1g1t4l_G33k Aug 03 '25
There's a lot there for beginners in 16 weeks. I would drop recursion. Leave that for programming 102. I'm sure you could expand on the last section regarding multi-file projects and how to properly use the linker. This seems to be missed by many curriculum. I see many young software engineers struggle with basic concepts of sections, linker maps, heap vs stack, debuggers, memory checking tools, etc.
A single lecture on how block structured languages are implemented by the compiler helped me so much. But, I had to wait until I took Survey of Computer Languages much later. That info would have helped so much earlier.
2
u/heptadecagram Aug 04 '25
makeand onlymake. They don't even need a Makefile! Justmake hello-worldwill build it for them at first.2
u/schteppe Aug 04 '25
Compiler warnings (-Wall -Wextra) and sanitizers. Can’t develop C without them.
How about including an example of reverse engineering/exploit of a super simple C program? This will make them understand lots about how C works, and how bad C code can open a door to hackers. See https://youtu.be/gh2RXE9BIN8?si=eo6UbtLoeX-zli3T
2
u/flatfinger Aug 04 '25
The name C is used to refer to both hosted application language which is for many purposes largely obsolete, and a family of very similar low-level programming dialects which for many purposes have never really been equalled.
Using the latter dialects, it's possible to write a program which doesn't need to run under any kind of operating system because the application is the operating system. For under $50, students could buy a Raspberry Pi Pico H and any of a fair number of kits that include a display, buttons, beeper, etc.
Set up students with a development environment that includes a few pieces of "magic" code that you supply for things like setting up the display and drawing pixels or text, and students should be able to get a good taste of what low-level programming with C is all about.
2
u/nderflow Aug 08 '25
Part 1/3
My original comment was too long so I'm splitting it into several comments.
You're going to notice that I'm very opinionated for someone who has never taught a beginner. But that's the Internet for you I guess. Some feedback on your plan:
2
u/bullno1 Aug 08 '25
How to develop with a debugger: breakpoint, trace point, memory breakpoint, watch etc...
I started with Pascal but using the debugger was a big part.
2
u/M_e_l_v_i_n Aug 10 '25
If you don't show the students how to read assembly and what the hardware is doing in (sufficient depth) they'll never be able to build a correct mental model for what the hardware is doing.
They won't fully grasp pointers, or calling conventions, or how the virtual memory system works or how time sharing between kernel/user space works, etc...
3
u/lovelacedeconstruct Aug 03 '25
Use raylib immediately to teach and ditch the boring ancient console applications
1
u/kramer3d Aug 04 '25
I would teach with a GUI based IDE and teach debugging concepts as well.
1
u/[deleted] Aug 04 '25
C was created so people could write low level stuff instead of assembly. I would rather see focus on this including shifts and masks than general programming.
1
u/gudetube Aug 04 '25
Bitwise operations are an entry-level subject. I'd say you need to at least get them assisted to Boolean Algebra, even if it's not "coding". It's a massive part of C
1
u/dreamingforward Aug 04 '25
It seems to me there is a major problem in C. There is an ampersand, star pointer, and then a -> operator. Three operations, yet there should only need to be two, and even then you can do it with one symbol ("*", say) and just position it differently (val = *p vs. pointer = var*).
1
u/misa_misaka Aug 04 '25
it is good, but before 11 and 12, better to talk about memory lifetime and scope first
1
u/JoshuaTheProgrammer Aug 04 '25
Teach functions and testing immediately. No need to introduce I/O right now, particularly since it’s complicated in C to do correctly (with sscanf, fgets, or getline). They’re familiar with functions from algebra 1, so there’s no need to delay it. Sure, you can put off the call stack until later, but function calls can be immediate. I also agree with everything skeeto said. Teaching GDB and Valgrind are essential, too.
1
u/Elias_Caplan Aug 04 '25
For the love of God can you teach how to do things securely. I hated doing tutorials or learning from people who didn’t program with security in mind which makes no sense because why leave that important aspect out? You’re not going to escape it whether on the job or you do it for fun making an application.
1
u/ImTheRealCryten Aug 04 '25
He mentions sanitizers and the flag -fsanitize that's part of Clang/GCC. They're lightweight and will maybe double runtime for your binaries compared to Valgrind that can cause extensive delays in some cases. I still find Valgrind useful though.
1
u/Cybasura Aug 04 '25
This might be alittle much but you might want to give them a heads-up and sprinkle in some introduction to git during the compiler/compilation stage (i.e. introducing them to gcc), which is around topic 3
this will help them get further because most university computer science courses dont even teach git and version control systems
During my final year project/capstone, I have had to work with a team of final years whom all didnt know git and I was the only one who did, and I had to teach them all some basic devops including git, which shows just how important that is
1
u/iLcmc Aug 04 '25
Looks very much like the contents page of a typical book. Most people can program in any language, few do it well because they were never properly taught architecture, design and software principles. This is why so much software out there is heavy, resource intensive and the source code is a coupled mess. I would strongly advise an intro to this first.. then maybe dedicated section on design inserted where they could construct a basic program... most c programmers even C++ approach first coding like assembly.. all in main or first class... stop.. think about the separation of duties/responsibilities, timing and priorities, synchronisation...only then can you consider threading it. Whilst I appreciate it's a language learning course.. don't forget about the grammar and sentence/ paragraph constructs!
1
u/[deleted] Aug 04 '25
Strings and File IO before pointers and arrays?
You had positive feedback apparently - or did you selectively pay more attention to positive feedback? Because for someone who never coded before this will be a lot.
1
u/grimvian Aug 04 '25
I really like the pedagoical approach Kris Jordan have - a colleague to you.
He have some great videos about structs, memory, modules and more.
https://www.youtube.com/playlist?list=PLKUb7MEve0TjHQSKUWChAWyJPCpYMRovO
1
u/Razzmatazz_Informal Aug 04 '25
In your section on compiling from the command line please include the following: What does -I do? What does -L do? What does -l do? What does -D do? What Makefile's are for (and the core idea of dependency rules and commands to update them). Show them (by using -E) that includes are expanded IN PLACE.
1
u/ICBanMI Aug 04 '25 edited Aug 04 '25
I know this will be some conflicting advice with what others gave you, but my 2 cents.
This order for some of the topics, but can put other things in between. Control structures, than functions, then arrays (and passing by reference), then pointers, and then afterwards strings. One of the reasons to do functions early is to get the students used to passing memory (by reference or by passing the actual value) while handing char arrays, but also to introduce the students to cyclomatic complexity. Get them started early in their learning to name variables and functions appropriately (save you some headache when grading).
Dynamic Memory Allocation will go extreme fast (hard to spend 2 classes in a week on), so at least give them an intro and assignment around a simple linked list. Every topic that involves memory should be referenced how it sits in static space, on the stack, and in the heap... so when they get to linked lists it'll be adding to what they already know (and can mostly struggle with pointer syntax). This is not to do the job of a data structures class, but to further conceptualize how memory works.
One thing I found valuable in the intro class was we talked about Big O notation and implemented some simple algorithms for sorting and searching. Not a replacement for data structures and algorithm class, but get them introduced to the concepts before they leave your class. This was way more valuable for mine and others careers than what a lot students/engineers do instead... which is get caught up in pre optimization trying to be smarter than the compiler. Those people are not fun software engineers to work with.
I went to a community college for my intro to java class and then later transferred to finish my undergrad at a four year college where everything was C/C++. Both colleges had failure rates for their intro class in the area of near 40%. The area where the 40% of the class diverged and began to struggle in the class was right at control structures. For people that have never done procedural programming, this was the area where they struggled, fell behind, and ultimately lead to them failing the class. Some people were not willing to put in the time for college assignments, but others struggled to conceptualize this part of the class. Try to build some early assignments around practicing procedural programming (e.g. write out a pyramid of asterisks and other shapes using for loops and basic math) and incorporate it with your lessons around arrays and file IO. Put extra emphasis on variable scope too. You can't save people from failing themselves, but can help the low performers by giving them extra attention in the areas they will struggle.
It's my opinion that anything tools should be kept to absolute basics-like a tutorial to install/run/compile. Force them for this class to learn to debug using printf statements and then if time at the end of the semester add a more advanced tool like the debugger.
1
u/iOSCaleb Aug 04 '25
I’m not a teacher, but I’d reorder items 5-8 to be 7, 8, 6, 5. Or maybe skip pseudocode entirely.
Beginners always think pseudocode is this big important topic, I guess because it’s a big, important-looking word, but it’s really just a slightly formalized way to plan out a program.
Loops seem like a natural topic yo follow conditionals. Both loops and conditionals control the flow of code, and they’re often discussed together.
I think it makes sense to show people how to use a function before you explain how to write one, and string functions offer an easy opportunity to do that while expanding the range of things your students can do with the tools they have.
Also, how do you introduce file operations without pointers? You’ll either need to do some hand waving “don’t worry about the stars for now, just trust me and put them where I tell you” or introduce pointers first.
1
u/archbtw-106 Aug 06 '25
I was a tutor for my class and most people are not experienced with programming as freshmen so giving them assignemnts and mostly letting them read. I had found that people hated learning programming on C which is sad but I think giving a final project maybe a good cli utility showing them platform and ide usage should be part of their research showing them setting stuff is fine. But in my base opinion covering ever aspect will be hard showing them how it is used is okay. For my class while I took it the teacher assumed we knew programming which made it hard for new comers to follow. I am not experienced in teaching I do lots of C programming mostly people with windows machine at least in my tutoring time faced issues the most and some things which are platform specific is not good. Students like learning when it is interactive which is like making a game which my class loved. Also if possible have an SI for better help. Dsa is not need as a begineer they are better of learning how to do projects because dsa can be learned out side of this class. If all they do is just learn without seeing how they apply it they will hate it and also otp of this make them read man pages how to use man page. My first C project was the browser dinasour game in cli.
1
u/KeretapiSongsang Aug 07 '25
dont teach C like it is 1998.
or using Borland C or any of those old C compilers.
1
u/CoroteDeMelancia Aug 07 '25
There's a lot of great responses, so here's my unique take:
Teach the basics of VS Code, such as the main windows, shortcuts, and the debugger. Even though it adds a little more mental workload instead of using a simpler alternative like Notepad++, it's immensely helpful in the long run, including their next semesters, because of less fumbling with suboptimal workflows and as an earlier introduction to essential tools.
Also, please write clean code, and I really mean Martin Fowler's Clean Code: very short functions with verbose, clear names. Even though I dislike his take on hard-limiting function lengths, it is immensely helpful for beginners to have thoroughly self-documenting code more than for professional developers because they really have no idea what any of the code does -- especially C, which is, honestly, a bit of a hostile language to be introductory to programming.
1
u/SlumpingRock Aug 07 '25
Personally, I think #14 about Compilation Pipeline should be moved up to become # 2. Header files and the Preprocessor and libraries are fundamental to C programming of any size. There needs to be a component about the Preprocessor and the basic directives of "include" and "define" and how it manipulates text and is a preprocessing step for text manipulation before the source code is compiled.
Also I suggest that you don't try to have these step by step topics but rather use samples of source to introduce multiple parts of C simultaneously rather than trying to divide it all out into specialized topics, at least at first. In other words start with an example of a simple program with only main that contains variable definitions, printf(), and some simple decision logic as a first step.
# 6 about functions and scope needs to be moved up near the top. Braces and scope of statements is also a key concept that needs to be learned early.
Since understanding the stack requires an introduction to the data structure, I'm not sure that I would go into much detail about that until later and just introduce it as a magical mechanism at the beginning.
I'm not a fan of flowcharts. I'd introduce programming as more of a how do you write a recipe for other people to use for cooking. I think that the idea of writing out a description of a procedure is more intuitive than using flowcharts.
0
u/ConsiderationFickle Aug 04 '25
I have found that students quite often enjoy "interacting" with the "outside world" using A/D Conversion and I/O via parallel and serial ports but this generally involves teaching 'C' with a micro...