Pages

C PROGRAMMING UNIT 1 (PART 2)

 Connector      A small, labeled, circular flow             
chart shape used to indicate a jump in the process flow.

Data    A parallelogram that indicates             
data input or output (I/O) for a process.

Program Development Steps:

1.  Statement of Problem     
a)                  Working with existing system and using proper questionnaire, the problem should be explained          clearly.
b) W hat inputs are available, what outputs are required and what is needed for creating workable          solution, should be understood clearly.
   2.  Analysis 
a)   The method of solutions to solve the problem can be identified. 
b)  We also judge that which method gives best results among different methods of solution.

3. Design
a)   Algorithms and flow charts will be prepared.
b)  Focus on data, architecture, user interfaces and program components. 

4. Implementation
   The algorithms and flow charts developed in the previous steps are converted into actual programs in the high level languages like C.  

a.   Compilation
The process of translating the program into machine code is called as Compilation. Syntactic errors are found quickly at the time of compiling the program. These errors occur due to the usage of wrong syntaxes for the statements.                     Eg:  x=a*y+b
There is a syntax error in this statement, since, each and every statement in C language ends with a semicolon (;).

b.  Execution
The next step is Program execution. In this phase, we may encounter two types of errors. Runtime Errors: these errors occur during the execution of the program and terminate the program abnormally.
Logical Errors: these errors occur due to incorrect usage of the instructions in the program. These errors are neither detected during compilation or execution nor cause any stoppage to the program execution but produces incorrect output.
General Structure of a C program:
              
          /* Documentation section */ 
                        /* Link section */ 
                        /* Definition section */ 
               /* Documentation section */
                /* Link section */ 
                 /* Definition section */ 
                /* Global declaration section */ 
main() 
Declaration part 
Executable part (statements) 
/* Sub-program section */ 
  The documentation section is used for displaying any information about the program like the 
purpose of the program, name of the author, date and time written etc, and this section should 
be enclosed within comment lines. The statements in the documentation section are ignored by 
the compiler.
  The link section consists of the inclusion of header files.
  The definition section consists of macro definitions, defining constants etc,.
  Anything declared in the global declaration section is accessible throughout the program, i.e. 
accessible to all the functions in the program.
  main() function is mandatory for any program and it includes two parts, the declaration part and 
the executable part.
  The last section, i.e. sub-program section is optional and used when we require including user 

defined functions in the program.