I guess K&R is stupid then.
Printable View
I guess K&R is stupid then.
K&R is outdated. Teaching it is stupid.
You include headers, not libraries. The header was not included, but this doesn't mean that printf() can't be called.
The biggest problem is the failure to #include <stdio.h>. The missing return type of main() is okay -- it defaults to int. The missing return statement is bad but not as bad as failing to include a header.Quote:
The program didnt want to compile on linux (gcc compiler) and I knew why - thats why I told the teacher what the problem is..
By default, C does link against the standard library. Which means you can call standard functions even without including the headers (sort of). It's bad practice, but it works (mostly). So his statement, strictly, is correct.Quote:
He came to me and started telling me that by default c includes some libraries - blablah - it was obvious he had no idea what he was talking about..
The good C programmers are employed as developers, they don't work at schools. You will never meet a competent C developer outside of an active workplace. On the other hand, the instructor might be well-versed in general software development concepts. I wouldn't discount him as a complete fool just yet.Quote:
It amazed me how some people can teach programming language without knowing s___t about it?
:pCode:int printf(const char *, ...);
int main(void) {
printf("hello world\n");
return 0;
}
Anyway, thread seems to be mostly about C. Moving. Should potentially even be in GD or Tech.
Rather stupid, when they taught us java in uni they showed us a "hello world" program and said don't worry about the rest, "you just have to write it" -- of course we'd later find out what it did, pretty cool way of teaching it, I suppose in a lecture of 300+ that's the only way...