2022 Developer Survey is open! Take survey.

Hot answers tagged

25 votes
Accepted

Why teach C using scanf without talking about command line arguments?

I think that the rationale is so you don't have to introduce arrays and array notation on day 1. Typically, arrays enter into the picture at roughly the same time as loops, which would take place a ...
user avatar
  • 31.2k
17 votes

Why teach C using scanf without talking about command line arguments?

Because everything around C language education is just utterly awful. That's really all there is to it. scanf should not be taught, but it is. It's rarely useful, ...
user avatar
14 votes

Why teach C using scanf without talking about command line arguments?

Because, traditionally, programs iterate over data. See JSP. Admittedly, prompting the user for data is weird, however we're talking about beginners here, having them try to remember what the ...
user avatar
  • 241
12 votes

Why teach C using scanf without talking about command line arguments?

From my own experience tutoring young CS students, user input is actually a tricky concept. If it were not for user input, the results of any program could be pre-compiled into nothing but its output....
user avatar
  • 1,031
11 votes

What should be included in a best practices C course?

I think an important aspect to any best-practices list is the rationale behind it. It is entirely too common for a programmer to, for example, insist that gotos and global variables are evil and then ...
user avatar
  • 519
11 votes

Lesson Idea: Arrays, Pointers, and Syntactic Sugar

You overestimate the complexity of 0-based indexing a lot. There is nothing complex in 0-based indexing. On the other side, the topic of the pointers is relatively complex. I don't think it has any ...
user avatar
  • 320
11 votes
Accepted

First programming Language : C or Python?

The question is actually more complex than it might appear, and really the answer can depend on the context. For example, at what age are the students when they are first taught to program? Is this ...
user avatar
10 votes

Lesson Idea: Arrays, Pointers, and Syntactic Sugar

This is a great explanation of why 0-indexing exists. As someone who barely knows what a pointer is, your explanation made perfect sense. If you wanted to dumb it down a little you could phrase it as: ...
user avatar
  • 4,754
10 votes
Accepted

Teaching C++ to students that know Java

Actually, the similarities between C++ and Java are fairly shallow and the differences are very deep. The syntax of both is derived from C, but the underlying ideas are very different. The biggest ...
user avatar
  • 34.7k
8 votes

Lesson ideas for introducing macros in C

I introduce C macros as a convenient way of using a single source file that can be used both when debugging code in development and for final delivery, without having to edit and and edit out test/...
user avatar
8 votes

Simple Pointer Examples in C

I would teach the use of arrays and array indices first (with pictures of a long row of physical mailboxes, or school lockers, etc.) Then later explain that all of a computer's and/or C program's (...
user avatar
  • 1,897
8 votes
Accepted

Should I teach modern web development in an introductory programming course? How?

If you want to teach students programming concepts along with web-development (HTML/CSS/JS) you should consider lacing programming examples or lessons with examples of HTML/CSS/JS or similar concepts ...
user avatar
8 votes
Accepted

What should be included in a best practices C course?

Too much, too fast "First semester". If I parse correctly, you say 60% students are new to programming. You say "The following points knock them out: they don't know how to test, they don't know how ...
user avatar
  • 195
8 votes

What should be included in a best practices C course?

This might be controversial, but I would make a point to explain that goto is not always considered harmful (and explain that the context of Dijkstra's "Go To ...
user avatar
  • 189
8 votes

How can we measure proficiency in programming languages?

I think you are taking a good approach with your boot camp. I'd only suggest a warm up exercise/mini-project in which students get some practice, perhaps writing in groups (pair-programming, perhaps). ...
user avatar
  • 34.7k
7 votes

What should be included in a best practices C course?

Note: I was under the impression that this question was by a faculty asking for advice on best practices for teaching a course on C. Instead it's a question by a proactive student that is ...
user avatar
  • 171
7 votes
Accepted

Teaching an absolute beginners class Operating Systems with Rust

Trying to learn many things at once: A language, an operating system, creating command line tools, compilation, etc. goes against cognitive load theory. That is why so many students fail. Keep it ...
user avatar
6 votes

What should be included in a best practices C course?

Lint I would not program in C without a lint tool e.g. gcc -Wall or pclint/...
user avatar
6 votes

What should be included in a best practices C course?

Your list is a bit narrow in one sense. I assume it is well matched to your specific course, but probably doesn't represent "best practice" in general. For example, valgrind is limited to linux, which ...
user avatar
  • 34.7k
6 votes

Should I teach modern web development in an introductory programming course? How?

I think it depends on what the goals for the course are. You are teaching an intro programming course, so what are the students expected to know when they finish? Data types and structures, loops, ...
user avatar
6 votes

Lesson Idea: Arrays, Pointers, and Syntactic Sugar

Draw ongoing attention to the potentially confusing point by banning cardinal descriptions of an element's position. Avoid referring to the "first element" or "second element" and talk only about "...
user avatar
6 votes

Simple Pointer Examples in C

What you have there is an excellent start, and is completely appropriate. I would go next into a puzzle to try to get them hooked. I would type the following code in front of them on your projector, ...
user avatar
  • 31.2k
6 votes
Accepted

Why and how is it efficient to process sorted arrays than unsorted arrays?

First, it is not "well accepted" that processing sorted array is more efficient. It depends on what you do. If you spend your time inserting, for instance, then sorted arrays are not necessarily a ...
user avatar
6 votes

Why teach C using scanf without talking about command line arguments?

Ultimately they need to understand both ways. Which you do first seems to be a matter of preference - or maybe just following the textbook. They need to understand at some point that 'main' in C is ...
user avatar
  • 34.7k
6 votes
Accepted

Order of parameter / variables on stack in C

I haven't delved into the details, but if a language doesn't define its own implementation (few do) then the implementation will vary depending on the architecture for which it is compiled. It will ...
user avatar
  • 34.7k
6 votes

A more recent book (or equivalent resource) on C programming to be acquainted with the latest standards (or the language grammar)

Ben Klemens' 21st Century C, now in its second edition, doesn't necessarily precisely meet this need, but I'd give it a shot anyway—it's not just a "description of the standard", but also ...
user avatar
5 votes

Students' confusion over C structure members and structure variables

First off, if your students are truly mastering pointers on their first course, hats off to you. That's quite a lot of material to pack into a semester. Structs involve a mess of abstractions not ...
user avatar
  • 31.2k
5 votes

First programming Language : C or Python?

Python is a fine language for learning algorithmic thinking and problem solving (see e.g. Downey's "Think Python" (Green Tea Press, 2nd edition 2016)). Python has an enormous ecosystem, ...
user avatar
  • 604
5 votes

First programming Language : C or Python?

I started teaching Python at NCSSM in 2004. Here are some reasons I chose it. It is direct and simple, and there is not a whole ton of boilerplate to deal with at the beginning. Hello, World looks ...
user avatar
  • 2,259
4 votes

Simple Pointer Examples in C

Yours is a fine first lesson, although it does not show the value of pointers. I would suggest also demonstrating how pointers can be used to implement a swap function. Ask the students (or step them ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible