nfoTools

T060101: C/C++ Programming

nfoTools tools>t060101 index.html 0.2.14 2023-08-24
nfotools Work in Progress Hard Hat Area

The purpose of this material is establishing an on-ramp and guard rails for exploration and use of the C Language in development and maintenance of computer software. Setup and preparation for creation of C Language projects on Microsoft Windows is featured, providing the base for confident self-study toward mastery of C Language for challenging projects, including games and graphical applications. Coverage is suitable for recreational computing as well as bridging to participation in cooperative and professional software-development efforts.

This is not an organized tutorial on C/C++. Instead there is selective focus on minitopics, ones that illustrate facets of C Language and its standard libraries. The emphasis is on self-exploration and experimental confirmation of understanding. Benefit of the material is gained by hands-on exploration and gradual mastery along with the mistakes and failures that the journey entails. Learning from mistakes is indispensible and expected.

If there is concern with respect to the relevance of C and its C++ connection, there is current evidence (July 2023) that learning C Language remains worthwhile. Some lessons of C Language explorations also apply, in altered form, to others of the most prominent programming languages of the day.

C/C++ Programming for Beginners and the Curious

This material is intended to be supplemental to the extensive guidance available elsewhere in books, web materials, and courses, especially the many free and inexpensive on-line ones. Technical use, here, starts with “Getting to Hello.”

One of the most helpful avenues in learning to program is reading the exemplary work of others. Learning to build, operate, modify, and extend interesting programs is invaluable. There are differences in styles and chosen tools to learn as well. Understanding those differences is preparation for adopting personal styles and also employing the styles of projects where one is participating.

Here, worked examples and full projects using C Language will be written and demonstrated using the Microsoft Windows Desktop PC as the instrument and as the target. The programming-language tools will be the freely-available Visual Studio Build Tools and the VC/C++ compiler that is part of that suite. There are sample programs and demonstrations of their operation that can be replicated to confirm understanding and successful setup.

Keeping It Clean C

For nfoTools projects of all kinds, use of the C Programming Language will be in Clean C, a form which can be compiled as “pure” C Language and also as C++ Language. The use of “C/C++” emphasizes that connection. Modern compilers tend to be C/C++ compilers (at least) and will accept Clean C as either C or C++.

There will be little attention to C++ features that are unacceptable in C Language (and vice versa). Focus is on Clean C to illustrate software-development principles and as a launching pad for further efforts, whether expanding into C++ or other programming languages/dialects. Exploration of alternative platforms and tools can also be done using experience with achieved results here as a confident starting point.

Available Materials

ID Started Status Topic
T060101b 2006-05-20 0.2.12 2023-08-24 C/C++ Resources
T060101c 2021-11-25 0.1.1 2023-06-08 Getting to “Hello”
T050101d 2023-06-08 0.0.4 2023-06-13 Hello, What’s Happening Here?
       
T060101a 2005-09-08 0.2.0 2023-05-20 Legacy Diary & Job Jar

Historical Context

C and C++ are now heavily-used programming languages. Substantial software, especially open-source software, is being developed and maintained using C Language. C++ programs can and often do rely on existing code libraries written in C. Many other programming systems allow components authored in C Language to be added/used and may be implemented in C Language themselves.

C Programming Language was introduced in the 1970s, evolved over time, formalized in International Standards, and now spoken of as ISO Standard C. (The term ANSI C is archaic, generally refering to the C89 ISO counterpart. There are some variations defined in POSIX that are not incorporated in the ISO Standards.)

From the outset, the appeal of C Language has been its ability to be used to make hardware-close programs that can also be carried portably in their C Language form to multiple hardware/software platforms. Portability of C Language programs started with flavors of Unix, including the eventual Linux. By virtue of its closeness to computer hardware (and relative ease of compiling), C Language became popular on minicomputers and then on microprocessors, along with BASIC and Fortran. C was supported on MS-DOS as well as Windows PC desktops, the Apple Macintosh, and now the newer forms of laptops,tablets, and other devices, including those powered by Google Android and Apple iOS.

It is not unusual for subsystems and libraries developed in C Language to be usable via “language bindings” in higher-level and alternative programming systems, such as Java and Python. In the case of C++, such usability of Clean C modules and libraries is immediate.

In concert with these varied applications, C has evolved over time, sometimes to strengthen its connection with C++, to improve portable use, and to encourage dependable programming practices, including with respect to programming secure code.

An important shift occured between C99 (issued around 1999) and C11 (issued around 2011). There are more features in C11, including some optional ones that were not part of C99. At the same time, C11 reduced some mandatory provisions of C99 to be optional.

The current specification, C17, is a maintenance release. C23 is imminent at this time. C23 will provide some new extensions and deprecate or completely obsolete some older features that are now discouraged.

Really, What’s the Best Programming Language?

Before one is eligible to enter the great programming-language debate, qualifying rounds must be endured to answer two crucial questions:

Be clear on why choice of programming-language matters to you. If it is about choosing a career, read job postings and, most of all, talk to people who have achieved beyond-entry-level employment about what they are actually using, not what they claim to prefer. Also pay attention to the diverse areas in which programming is done and how that factors in.


Discussion about nfoTools is welcome at the Discussion section. Improvements and removal of defects in this particular documentation can be reported and addressed in the Issues section. There are also relevant projects from time to time.