Intro to Programming With C

From FreekiWiki
Revision as of 23:25, 19 January 2010 by Tonyr (talk | contribs) (Add page to Classes category)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is a work in progress

Contact is Kurt Krueger allez@att.net

At some time before the first class is taught, there will be useful information in this Wiki.

However, unlike the page for the Bash class, there will be no attempt to make this a web course.


What to expect

This is an introductory course to programming with the "C" language. Students will learn to write rudimentary programs. Homework assignments will be given, expect to spend time outside of class lab time for the assignments.

Will this class make me an expert C programmer? No. An introductory class cannot cover all the material in detail but will form a basis for further learning. We hope to be able to offer a more advanced follow up class in the future.

Why C ?

C can be defined as the root of all evil. It was developed in the 70's for the purpose of generating efficient programs. One of the neat things created was the Unix operating system, Linux is the PC port of Unix. All languages developed under Unix have their roots in C. C is still widely used in the industry.


C vs. C++

C++ was developed later in the game when the Object Oriented language craze began. The most obvious difference is that C is procedural[1] while C++ is object oriented [2]. C++ was implemented as a superset of C, so the entire C language is embedded in C++ including the procedural paradigm. In many cases the language is referred to as C/C++.

Some Historic notes

In the days preceding the C language, operating systems were generally written in assembly code. This is a very low level and tedious, error prone way to write code. But since assembly code is one to one with the underlying processor's instruction set it created very fast and concise code. The coder also had full control of anything the processor could do.

About the time that C was conceived, a ground breaking computer architecture was created by Digital Equipment Company (DEC, bought by Compaq, in turn bought by HP) named the PDP-11. One of its claims to fame was a stack based instructions. The implementation of these instructions was native to the hardware. Competitor's hardware would require several instructions to accomplish the same thing. This was very important in the days where maximum computer memory was in kilobytes and clock speeds were under 1 Mhz. The PDP-11 could handle a maximum of 28K of memory as it was created as a mini computer.

The developers of the C language wanted something that was of a higher level, i.e. more readable and more productive. But they didn't want to lose any of the control that assembly language afforded. This resulted in syntactic constructs that were strange to the mainstream programmers of the day (e.g. b = *p++, a &= 2). With only had 28K of memory, one had to do as much as possible with each code instruction so some memory was left over for data.

Proposed schedule

This schedule is subject to change based on the experience and desire of the students. Each class will have homework assignments with the associated material, and a reading assignment. Lab time will be provided at the end of each class, but students should not depend on lab time being sufficient to complete all the homework.

Class Subject matter Number

1. Developing algorithms. Sample program. Data types, arithmetic operations.

2. Building and executing. Data conversions, data input/output

3. Decision statements. if, else, switch. Loops for, while, do

4. Arrays and structures

5. Review, catch up. Possible quiz.

6. Functions

7. C preprocessor, #define, #include, etc.

8. File manipulation, string functions, other useful stuff in standard libraries

9. Error checking, intro to pointers

10. Introductory pointer arithmetic. Misc useful functions.