So would it be more appropriate to teach the students this or should we stick with C89?
Unfortunately, this question cannot be answered in an objective way, so it will be a bit opinionated.
If I was a teacher, I would use modern C, that is C11 or newer. But I would also frequently show examples of how it was done in the past. Many of the changes are aimed towards better programming habits.
However, one thing in newer C (which was made non-mandatory in C11) that I would advice against as a teacher is VLA:s. You can read my answer here to understand why: Why VLA:s are bad Note that this is a thing that people disagree on. I'm not claiming I'm correct. VLA:s have their pros, but definitely also their cons. If you want to teach VLA:s, it's important to also teach when and how NOT to use them.
If you want to use an old version, then at least stick to C99. The improvements from C89 to C99 are really major. In most cases, the improvement mainly is about readability convenience, but that should not be underestimated.
Example1, loop variables: (Imho, VERY important for good code structure)
/* C89 */
int i;
for(i=0; i<10; i++) {
// C99
for(int i=0; i<10; i++) {
Not only is this more convenient and readable. It also makes the loop variable disappear when the end of the loop is reached, keeping it local.
Example2, comments:
/* C89 comment */
// C99 comment, and is not valid in C89
Example3, initializers:
struct myStruct {
uint8_t a;
char b;
char *s;
};
struct myStruct createStructC89(uint8_t a, char b, char *s)
{
struct myStruct x;
x.a = a;
x.b = b;
x.s = s;
return x;
}
struct myStruct createStructC99(uint8_t a, char b, char *s)
{
struct myStruct x = {a, b, s};
return x;
}
The decision might also depend on the goal of the C course.
If it aims towards becoming a C programmer, then I would say that it is important to point out the differences, because most professional C programmers will have to deal with legacy.
On the other hand, consider the cases where C is just chosen as a language for to teach programming for beginners, or if the course aims to come close to the hardware, like courses in computer architecture. Then I would definitely go for C11 or C18. I would consider requiring all handins to compile with gcc -Wall -Wextra -Werror -Werror=vla -pedantic -std=c11
-Wall -Wextra
Enable extra warnings
-Werror
Treat warnings as errors. Typical school tasks should have no warnings.
-Werror=vla
Don't allow vla
pedantic
Disable many extensions and force the program to (mostly) conform to the standard specified
-std=c11
Use C11. Change to C99 or C18 if desired.