Learning how to program (23, permasaged)

16 Name: #!/usr/bin/anonymous : 2007-08-21 09:22 ID:OvZh1M8r

>>15
Say wut?

char buffer[60] behaves very much like char *buffer, except in the latter case no storage is allocated and the pointer goes nowhere until assigned. The finer distinctions can be ignored until the second course on C programming; just like you and I did way back when.

Pointer arithmetic is perhaps worth 30 minutes of explaining and a few slides. Void pointers are a simple enough topic, to be explained once malloc() and free() have been. Typecasting, expressions and the ternary operator are things that any Java course has to deal with, and it apparently isn't giving them any insurmountable problems. The in-memory format of structs is again something for the advanced half of a two- or three-course whole.

The sizes of standard datatypes can be explained as they are in the Typical Modern Implementation on a Typical Modern ABI. Students who're particularly interested can go crawl through the standard, which is pointed to in a footnote of the lecture material.

The preprocessor can be explained by the course book; there's nothing particularly advanced or hairy there. POSIX is out of scope for a set of courses on C. Libraries are a particular case of modular programming. Memory allocation is not especially difficult. Buffer overflows etc. can be explained in terms of undefined behaviour, i.e. nasal demons; their prevention is better explained in the context of a course on security-conscious programming (the principles of which apply just the same to Java as they do to C).

Numeric programming is a broad enough topic to be in a course of its own, and typically is. Signedness of numbers is CS 101, as are bitwise operations. Use of the compiler can be explained with a 5-page appendix of the lecture material, with a link to the manual pages and a hearty note of "you don't really need more than the first page until we get to modular programming".

Don't underestimate newbies. You were one, once, and look at yourself now.

This thread has been closed. You cannot post in this thread any longer.