What is pseudocode?
A pseudocode in programming is a method that could be used to represent an algorithm. Or in other words and pseudocode is an artificial and informal language which can be used for developing an algorithm. A pseudocode is an artificial and informal language that helps programmer to develop program in very effective manner.
It is text biased detail design tool.
Some characteristics of pseudocode are:
- It is not written in a specific syntax that is used by a programming language therefore it cannot be executed by the compiler.
- Pseudocode is written in a format that is closely related to high level programming language structures.
- Most of the formats of pseudocode are borrow from the stucture of popular programming languages like C,Lisp,FORTRAN etc.
- Natural language is also use in pseudocode when presenting details that are not importent.
- most of the algorithms are presented using pseudocode since they can be read and understood by the programmers who are familiar with diffrent programming languages.
- pseudocode includes some statements like while,do,for,if,switch,READ,PRINT etc.
Rules for write an pseudocode:
- Always capitalize the initial word.
- Make only one statement per line.
- Keep statements language independent
- always end multi-line sections using END keywords.
- Keep it understandable .
- Keep it simple.
- Keep it concise.
Example of pseudocode:
Pseudocode to add two numbers in c programming.
BEGIN
NUMBER s1,s2,sum
OUTPUT("Input number 1:")
INPUT s1
OUTPUT("Input number 2:")
INPUT s2
sum=s1+s2
OUTPUT sum
END
Advantages of pseudocode:
- It like a programming language therefore it can be easily convert into a code.
- It can be easily understandable by the programmer.
- It is programming language independent.
- Natural language can be use in it.(only when presenting details which are not importent).
- Can be easily understandable by the person who have few knowledge about programming.
- It allows the programmer to focus on main idea of a problem not on syntax of that problem.
- Pseudocodes are more readable as compared to algorithms.
- It can be easy to modify it.
Disadvantages of pseudocodes:
- It cannot be compiled by the compiler.
- We cannot check it accuracy because it can't be compiled by the compiler.
- It does not have any specific programming language.
- It is very time consuming.
- It is very hard to communicate with the persons which have no coding background.
Post a Comment