Aug 07, 2023 04:44 PM
95 Views
I learned C from the Kernighan and Ritchie book The C Programming Language, 2nd edition.
I found it was all I needed. It lacks exercises and solutions, but you just make those up yourself as you go along. Apply what the book says. Ideally, build a project.
The project I built was interesting. I was an undergraduate work placement developer and was asked to build a utility.
It had to:
Read any valid C source file
Prepend the letter q to the keywords if, else, switch and case
Add a matching end delimiter to the code block: qifend, qswitchend, qcaseend
Preserve everything else as-is
The reason for that bonkers tool was equally bonkers. “Head Office” had decreed that all C language software must be written that way and passed through another tool which converted that “qc” language into Nassi-Shneiderman charts.
The local dev team decided they would continue to write C code in the normal way, pass the files through my utility, then send them on to head office, should they so wish to chart them.
Great project though. I learned a lot. I wrote it very, very badly indeed with a bizarre mix of global variables and recursive procedure calls(ugh) and procedures that handle unrelated responsibilities(ugh again). I didn’t know any better. But I did get quite good with the basics of the C language.