Guidelines for Developing a C Program

The Program development process includes three important stages, namely, program design, program coding and program testing.

Program Design 

Program design is basically concerned with the development of a strategy to be used in writing the program, in order to achieve the solution of a problem.

The program design involves the following stages:

  • Problem analysis
  • Outlining the program structure
  • Algorithm development
  • Selection of control structures

Problem Analysis

Before we think of a solution to a problem, we must fully understand the nature of the problem and what we want the program to do. Without the comprehension and the definition of the problem at hand, program design might turn into a hit-or-miss approach. We must carefully decide the following things:

  • What kind of data will go in
  • What kind of outputs are needed and
  • What are the constraints and conditions under which the program has to operate.

Outlining the Program Structure

C as a structured language lends itself to a top-down approach. Top-down means decomposing of the solution procedure into tasks that form a hierarchical structure. An important feature of this approach is that at each level, the details of the design of lower levels are hidden. The higher level functions are designed first, assuming certain broad tasks of the immediately lower level functions. The actual details of the lower level functions are not considered until that level is reached. Thus the design functions proceeds from top to bottom, introducing progressively more and more refinements.

This approach will produce a readable and modular code that can be easily understood and maintained. It also helps us classify the overall functioning of the program in terms of lower-level functions.

Algorithm Development

The next step is to work out a detailed definite step-by-step procedure which is known as algorithm for each function. The most common method of describing an algorithm is through the use of flowcharts. The other method is to write what is known as pseudocode. The flowchart presents the algorithm pictorially, while the pseudocode describe the solution steps in a logical order. 

A problem might have many different approaches to its solution. We must consider all possible approaches and select the one which is simple to follow, takes less execution time and produces results with the required accuracy.

Control Structures

Sequence structure denotes the execution of statements sequentially one after another. Selection structure involves a decision, based on a condition and may have two or more branches which usually join again at a later point. if…else and switch statements in C can be used to implement a selection structure. Looping structure is used when a set of instructions is evaluated repeatedly. This structure can be implemented using do, while or for statements. 

A well designed program would provide the following benefits:

  • Coding is easy and error-free
  • Testing is simple.
  • Maintenance is easy.
  • Good documentation is possible.
  • Cost estimates can be made more accurately
  • Progress of coding may be controlled more precisely.

 To learn C language join our course for C. See the syllabus of C Language here.

Leave a Reply

Your email address will not be published. Required fields are marked *