C Language : Pseudocode

Pseudocode :

Pseudocode is part English, part program logic, its purpose is a describe, in precise algorithmic detail, what the program being designed is to do. This requires defining the steps to accomplish the task in sufficient detail so that they can be converted into a computer program. It was made up of 2 Words : Pseudo and code.
Pseudo means imitation and code refers to instructions, written in a programming language.
It does not obey the syntax rules of any particular language.
It is not real programming code.
Keywords for writing Pseudocode.

  Input      : READ, OBTAIN, GET
  Output     : PRINT, DISPLAY, SHOW
  Initialize : SET, INIT
  Add one    : INCREMENT, BOMP.

List the Guidelines for Writing Pseudocode :

Any language should be used for writing statements. Statements should be long independent.

  1. It must produce solution.
  2. Logic must be decomposed to a level of single loop or decision.
    Example : Not like search the list and find the customer with highest balance.
  3. Write each instruction in separate line.
  4. Should be concise : Ignore unnecessary details.
  5. Use programming shorthands - if-then-else etc. without writing equivalent english.
  6. If it can not be translated to working code means something is wrong.

  7. Keywords should be highlighted by capitalizing them.
  8. Type of variable used is clear from context.

Benefits of Pseudocode :

  1. Allow designer to focus on logic of algorithm, not on details of long syntax.
  2. It is long independent.
  3. It can be translated to any computer language code.
  4. Unlike flowcharts, pseudo codes are concise, more readable and easier to modify.
  5. It allows designer to express the design in plain natural languages.

Guidences for Pseudocode & Algorithm :

In text and lecture, algorithm are often expressed in pseudocode. Both are almost same.
Guidenlines for algorithm and pseudocode are.

  1. Each Algorithm will be logically enclosed by 2 statements START, STOP
  2. To accept data from user, INPUT or READ statement is to be used.
  3. To display any used message or content of variable, PRINT statement is used. Message should be enclosed within quotes.
  4. Assignment : =
  5. Arithmetic Operator : +(Add), -(Sub), *(Mul), /(Div)
  6. Relational : >, >=, <, <=, ==, !=
  7. Logical : AND - ( && ), OR - ( || ), NOt - ( ! )

0 Komentar untuk "C Language : Pseudocode"

Back To Top