Which version of C is more appropriate for students to learn- C89/90 or C99?
While I generally agree with the others, it is worth noting that K&R is such a good book that it might be worth learning C from it and then updating your knowledge as you read about the C99 standard.
There is no reason to learn C89 or C90 over C99- it's been very literally superseded. It's easy to find C99 compilers and there's no reason whatsoever to learn an earlier standard.
This doesn't mean that your professor won't force C89 upon you. From the various questions posted here marked homework, I get the feeling that many, many C (and, unfortunately, C++) courses haven't moved on since C89.
From the perspective of a starting student, the chances are that you won't really notice the difference- there's plenty of C that's both C99 and C89/90 to be covered.
Use the C99 standard, it's newer and has more features. Particularly useful may be the bool
type in <stdbool.h>
and the int32_t
etc. family of types; the latter prevents a lot of unportable code that relies on int
s having a certain size. AFAIK, it doesn't invalidate K&R, though some example programs may be written in a slightly different style now.
Note that some compilers still don't support C99 properly. I believe that GCC still requires the use of a -std=c99
flag to enable it; many Unix/Linux systems have a c99
command that wraps GCC and enables C99.
The same goes for many university professors. I surprised mine by handing in a program that used bool
in my freshman year. He'd never heard of that type in C :)