Main Content

Adding the pieces together to make a complete language - C

Archive - Originally posted on "The Horse's Mouth" - 2011-08-11 07:47:41 - Graham Ellis

Once we've covered the fundamentals of programming on a C course, we move on to cover pointers, arrays, structures, strings, input/output, and dynamic memory allocation. We teach and illustrate each of them, and we have our delegates write practical exercises to make sure that they have a grasp of the concepts, and are aware of the common pitfalls.

But a language like C is really all about the COMBINATION of all the factors, and long after the course would normally have concluded yesterday evening, I wrote a "pull it all together" example in front of the group - reading an unknown number of records from a file (so we had to use the dynamic memory stuff), and forming each of the records into s structure in that dynamic memory. We then called functions to analyse and extract the information from the structures and report it back to the user of the program. Full source code [here].

The example ... (not really a surprise) ... will lead us nicely into object orientation, and C++, which I'll be tackling with the same group and others from 9 O'Clock this morning; OO can be a really tricky concept to see in practical examples early in learning as it's a system / technique that's really good for larger projects, but examples such as the one I'm using this week ease it naturally in!

To learn about our C and C++ course range, see [here].