Compiling with c89

Viewed 148

I just started to learn C and I am reading a book about it. Unfortunately, it is a bit old and it is using c89. I looked around the internet but I guess c89 was used 10 years ago no one wrote anything about it. I want to compile my code in c89 but from what I understand visual code doesn't have a c89 compiler. Is there any c89 compiler I can use?

2 Answers

Yes, there are C89 compilers available. You can for instance use gcc -std=c89 -pedantic to get a compiler very close to the C89 standard.

If the book is about C89, it is most likely not very good. Partly because it is about an ancient standard that does not have modern features that really makes it much easier to code C. But also because if it's about C89, it's likely very old and predates modern C design ṕatters in general.

I recommend treating that book as a some kind of historical relic. Read it for fun, but don't use it to learn coding. If you want to learn modern C, then Modern C is a good choice. It's not aimed at total beginners, but it teaches much better C code than any C89 book.

You mentioned in comments that the book is "The C Programming language". I would not recommend it for tutoring.

Just about the only thing that is present in C89 and missing in newer C standards is the gets function, which you should never use anyway.

Related