A program is a set of instructions given to the computer system to perform certain operations on one or more input data to produce one or more output.
The instructions must be
It is to be noted that a program works on some input data & produces some results in the form of data.
A programmer, when he gets on to write a program, need to practice certain discipline while writing a program. What do we mean by this?
The programmer should never be in a hurry to begin writing the program with the syntax of the language be it C, Pascal, Basic or any other programming language. The given problem must be analyzed first and a logical procedure to solve the problem should be written in the English language, a language that you are conversant with, so that you can focus completely on the solution. This is what we call an ALGORITHM.
While writing an ALGORITHM, the focus of the programmer is solely on identifying & writing down the procedure or set of instructions needed to solve the given problem.
The next step is to represent the procedure written, pictorially, i.e. to convert the procedure or set of instructions, viz. the algorithm, in a pictorial form. This enables the programmer to comfortably review his logic and correct any errors made while writing the algorithm. This pictorial representation is called a FLOW CHART. Here the focus is on the logical flow of data (viz. the inputs) which are to be processed by the program to produce the desired output(s).
Flow charts comprise an important part of the program documentation and can become very useful for future reference as well, whenever a bug is encountered and also whenever the program needs to be updated or modified.
After having drawn the Flow chart(s), it is good practice to represent the flowchart in the form of PSEUDO CODE. A pseudo code, as the name suggests, is very close to the actual code in which you will eventually write your program. However, while writing the pseudo code you are not bogged down by the syntax of the programming language, to which you are new, and your focus is solely on preparing the program outline/structure with the help of the flow chart already drawn. The only thing is that now you are representing it in a language that is much closer to the programming language format but without getting too concerned about the detailed syntax.
Let us consider a simple example to understand what we mean by -
THE PROBLEM: Find the area of a circle, given the numerical value of its radius.
Now you are ready to write the actual program in the programming language of your choice - in this case it is C. Since you have already finalized your program structure while writing the pseudo code, at this stage your focus is solely on the programming language syntax. You focus here in writing the program in the correct syntax so that there are no errors.
Note that in the example below, we have added comments so that you can understand what each line does and compare it with your pseudo code.
If you adhere to these 4 steps in your early days of learning programming, I can assure you that you will make a good programmer.
How to move your Email accounts from one hosting provider to another without losing any mails?
How to resolve the issue of receiving same email message multiple times when using Outlook?
Self Referential Data Structure in C - create a singly linked list
Mosquito Demystified - interesting facts about mosquitoes
Elements of the C Language - Identifiers, Keywords, Data types and Data objects
Moving Email accounts from one cPanel server to another
How to pass Structure as a parameter to a function in C?
Rajeev Kumar is the primary author of How2Lab. He is a B.Tech. from IIT Kanpur with several years of experience in IT education and Software development. He has taught a wide spectrum of people including fresh young talents, students of premier engineering colleges & management institutes, and IT professionals.
Rajeev has founded Computer Solutions & Web Services Worldwide. He has hands-on experience of building variety of websites and business applications, that include - SaaS based erp & e-commerce systems, and cloud deployed operations management software for health-care, manufacturing and other industries.