Programming and Data Structures

7. PROCEDURAL PROGRAMMING LANGUAGE

PROCEDURAL PROGRAMMING LANGUAGE

Procedural programming is a programming paradigm (a pattern or model) that focuses on creating procedures or routines to solve problems.

Procedural Programming languages follow a sequence of instructions and conveys it to the computer. Procedural programming depends on procedures. As procedural programming language follows a method of solving problems from the top of the code to the bottom of the code, if a change is required to the program, the developer has to change every line of code that links to the main or the original code. If the user wants to code a program, they would have to follow a sequence of instructions and thereby enter the instructions. In addition, we can say that when a  problem is need to be fix using procedural programming, the developer will start with  the problem (procedure) and then he logically fragment the problem down into sub  problems (Sub-Procedures). Subsequently, this process will continue until a sub- procedure is simple enough to be solved by itself. Examples for procedural programming languages include C, COBOL, FORTRAN and VB, PASCAL.

Pascal Program Structure

A Pascal program basically consists of the following parts −

  • Program name
  • Uses command
  • Type declarations
  • Constant declarations
  • Variables declarations
  • Functions declarations
  • Procedures declarations
  • Main program block
  • Statements and Expressions within each block
  • Comments

Every pascal program generally has a heading statement, a declaration and an execution part strictly in that order. Following format shows the basic syntax for a Pascal program −

program {name of the program}
uses {comma delimited names of libraries you use}
const {global constant declaration block}
var {global variable declaration block}
 
function {function declarations, if any}
{ local variables }
begin
...
end;
 
procedure { procedure declarations, if any}
{ local variables }
begin
...
end;
 
begin { main program block starts}
...
end. { the end of main program block }
 
 
C-language program
a general structure
1 Calling header files #include <stdio.h>
2 Main function main()
3 Starting brace {
4 Variable(s) declaration int a;4 Variable(s) declaration int a;
5 Executable statement(s) printf () etc
6 Closing brace