To develop a C program, some of the unix programming books will tell you snippets, but I don’t know about the C program architecture book.
Make use stack . Often, when you call a procedure, you want to have the variables allocated in the frame of the caller’s stack and pass them pointers to the procedure that you want to call. This will be significantly faster than dynamic allocation of memory using malloc() and much less error prone. Do this when necessary.
C does not do garbage collection , so dynamically allocating data items is more complicated, and you need to track them to make sure they are freed. Variables allocated on the stack (see 1) are more “idiomatic” where they are applicable. In addition, you do not need to free them - this is a bonus for local variables.
Regarding (2), consider an architecture in which your functions return a status or error code and pass data to the stack and exit using the stack according to (1).
Find out what setjmp() and longjmp() . They can be very useful for general error handling mechanisms instead of the functionality for handling structured exceptions.
C does not support exceptions. See (3).
Lint is your friend. Splint is even more friendly.
Find out what preprocessor does and what you shouldn't do with it, even if you can.
Learn all the possibilities of endian-ness , word alignment , pointer arithmetic and other low-level architectural arcana. Contrary to popular belief, this is not rocket science. If you feel enthusiastic, try to learn assembly language and get good knowledge from it. It will do a lot for your understanding of what is going on in your C program.
C does not have a concept of the scope of a module, so plan your use of inclusions, prototype declarations, and use extern and static to make private scopes and import identifiers.
GUI programming in C is tedious on all platforms.
An attempt (10) to learn the C API of at least one scripting language such as Tcl , Lua, or Python. In many cases, the best use of C is the main high-performance application engine, which is largely written in something else.
The equivalent of a constructor is an initializing function in which you pass a pointer to the element you want to configure. Often you can see this as a function call that looks like setup_foo(&my_foo) . It is better to highlight the selection from the initialization, since you can use this function to initialize the element that you allocated on the stack. A similar principle applies to destructors.
Most people find the Hungarian notation that it reads as written by the Hungarian. An exception to this are native Hungarian speakers, who usually find Hungarian notation about as distinctly as Cuneiform. . Unfortunately, Hungarian notation is common in Windows software, and the entire Win32 API uses it, expecting to affect the readability of software written on this platform.
C / Unix books, even really good ones, such as those written by the late Richard Stevens, are generally available pretty cheaply on the Amazon market. In random order, do not get a copy of K & R, Stevens APUE and UNP 1 & 2, Dragon, Rochkind, Pearls, Petzold and Richter Programming (if running on Windows) and any other classic C / Unix. Read, draw on them with a pencil and generally interact with books.
There are many, many good C / Unix resources on the Internet on the Internet.
Read and understand the Ten Commandments of C Programming and some of the meta-discussions about why and why behind these commandments. It will show its age to a certain extent, although most of it is still relevant, and obscure compilers are still quite common in embedded systems world .
Lex and Yacc are your friend if you want to write parsers.
As Navicore points out below (+1) , Hanson 's C Interfaces and Implementations is a flawless interface / implementation design for a modular architecture with tons of examples. I really heard about this book and heard about it, although I cannot claim to have read it. In addition to the C-idioms I described above, this concept is perhaps the core of good procedural design. In fact, other procedural languages, such as Modula-2, really make this concept explicit in their design. This may be closest to the book "Software Architecture" in print. A.
Read the C FAQ .