Previous: Chapter 2
Up: Table of Contents
Previous Page: Chapter 2
Next Page: 2.1 A Simple C Program

2 Basic Concepts

Learning to program is a lot like learning to speak a new language. You must learn new vocabulary, i.e. the words of the language; the syntax, (also called the grammar); i.e. the form of statements in the language, as well as the semantics, i.e. the meaning of the words and statements. This learning process usually begins slowly but often you find that with just a few basic words and phrases you can begin conversing and getting your thoughts across. In this chapter we present a few of the basic statements of the C language so that you can write programs from the beginning.

As in spoken languages, the first thing you need is something to say -- an idea. In the programming world, this idea is often in the form of a task, i.e. something you would like to have done by the computer. The task may be described in terms of what information is to be provided to the computer, what is to be done with this information, and what results should be produced by the program. A program is often developed in small increments, starting with a relatively simple version of the task and progressing to more complex ones, adding features until the entire task can be solved. The focus is always on the task to be performed. The task must be clearly understood in order to proceed to the next step, the development of an algorithm. As was discussed in the previous chapter, an algorithm is a step by step description of what must be done to accomplish a task. These can be considered to be the most important steps in programming; specifying and understanding the task (what is to be done), and designing the algorithm (how it is to be done). We take this approach beginning in this chapter, and we will discuss task development and algorithm design in more detail in Chapter .

Once an algorithm is clearly stated, the next step is to translate the algorithm into a programming language. In our case this will be the C language. Using the vocabulary, syntax, and semantics of the language, we can code the program to carry out the steps in the algorithm. After coding a program, we must test it by running it on the computer to ensure that the desired task is indeed performed correctly. If there are bugs, i.e. errors in the program, they must be removed; in other words an erroneous program must be debugged so it performs correctly. The job of programming includes the entire process: algorithm development, and coding, testing and debugging the program.

At the end of the Chapter, you should know:



Previous: Chapter 2
Up: Table of Contents
Previous Page: Chapter 2
Next Page: 2.1 A Simple C Program

tep@wiliki.eng.hawaii.edu
Tue Aug 16 14:01:55 HST 1994