7 ms·
"My opinion is that one can easily teach these "high level concepts" (loops, syntax, control flow, etc) using C." Then one day you have a line of students goin
by betterunix 13y ago
"My opinion is that one can easily teach these "high level concepts" (loops, syntax, control flow, etc) using C."
Then one day you have a line of students going out the door at your office hours who all need help understanding why their program is segfaulting. Some tried to free a pointer to something allocated on the stack, others tried to free a pointer twice, and one or two managed to find some undefined behavior that even you did not know about.
It is not that C lacks high-level structures, it is that any non-trivial C program must deal with low-level issues.
"the student will learn these "high level" concepts without any clue about the underlying implementation"
That is what computer architecture and compilers courses are for. You learn more about the implementation of your programs by writing a compiler than you do by using C, and writing a compiler in a high-level language is almost always less painful than writing it in C. Somewhere in the compilers course students should also learn how a garbage collector works, which will help them understand why they are seeing the behavior they see.
- plg 13y agoI disagree : you can easily teach high level concepts like control flow, branching, loops, logical operations, if/then, without even using pointers. You can even do some pretty high level numerical algorithm stuff just using plain old stack variables.
- mahyarm 13y agoThis is the first exposure to programming & computation class, anything superfluous such as semicolons or the keywords just trips people up and gets in the way of learning. You have to tell people to ignore all of the extra magic words just to get started, even though they would really like to know what it all means. Look at Java: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World"); } } C: #import <stdio.h> int main() { printf("hello"); return 0; } Python: print "Hello"
- njbooher 13y ago#import <stdio.h> -> #include <stdio.h>
- betterunix 13y agoReading inputs without using pointers is pretty complicated in C...
- zvrba 13y agoIn C, you can't even get user input without using pointers. Command-line argument? argv is a pointer. fgets/fscanf into a variable? You have to use a pointer. Yes, you can tell the students to treat those stars and ampersands as necessary magic that they don't need to understand right now, but you're still using pointers.