ComProg Notes
ComProg Notes
Information systems can be described by four of their key components which are:
1. Decisions
2. Transactions and processing
3. Information and its flow
4. Individuals or functions involved.
Program Development is the art of preparing and designing necessary structures to develop computer
instructions that enable the computer to solve a problem or perform a task.
1. PLANNING
This stage involves identifying the problem and defining the problem in simpler terms, identifying the program
requirements (inputs, outputs the formulas needed), and planning for the solution.
2. PROGRAM DESIGN
This stage deals with the flow of the program, the way it should produce output and gather inputs, the
interface or the working environment of the program, and how it should be used.
3. CODING
Once the design process is complete, the actual computer program is written, i.e. the instructions are written
in a computer language.
4. DEBUGGING
At this stage, the errors in the programs are detected and corrected. This stage of program development is an
important process. The process of correcting mistakes in a program is called debugging.
5. TESTING
In this stage, the program is tested on a number of suitable test cases. A test plan of the program has to be
done at the stage of the program design itself. This ensures a thorough understanding of the specifications.
6. DOCUMENTATION
Documentation is a very essential step in program development. Documentation helps the users and the people who
maintain the software.
7. MAINTENANCE
The final stage in programming is in maintaining or updating the program. This is the stage where the programmer is
tasked to keep the program running smoothly and updated with the developments and changes in the field where it is
used
Programming Language
Programming Language is a special language used to write computer programs. Programming languages
can be used to create programs that control the behavior of a machine.
Basic Syntax of C Programming Language
1. Header Files
Header files contain a bunch of files that help the user to include the predefined functions
according to his requirements. The header files can be applied using the preprocessor directive
#include.
Syntax:
#include<file> or #include “file”
Some of the commonly used header files in C are as follows:
File Description
stdio.h Input/Output Functions
conio.h Console Input/Output Functions
stdlib.h General Utility Functions
math.h Mathematics Functions
string.h String Functions
ctype.h Character Handling Functions
time.h Date and Time Functions
float.h Limits of Float Types
limits.h Size of Basic Types
Functions to determine the type contained in wide character
wctype.h
data
2. Main Function
The main function is like the main body of the whole programming code. The execution of the program starts
from this line that’s why it is mandatory to have main function for any C program.
Syntax:
main(){…}
The program codes the user wish to execute should be written inside the curly braces. Other than that, the
program won’t run and will generate an error.
3. Tokens
The C syntax/program consists of a set of tokens. They may be identifiers, variables, or symbols.
5 types of tokens in C Language, are:
Keywords- are a set of words used for a special purpose in the program. They are reserved words. Some
examples are for, while, switch, break, goto, etc.
Identifiers/Variables - It is a data item in the program whose value can be changed; thus, it is called
variable. They are a combination of letters and digits.
Constants - Constants are those values that cannot be changed during program execution.
Punctuators - Punctuators are used for formatting the C program statements and expressions. Examples
for punctuations are: [ ] ( ) { } : ; , =
Operators- There are various operators in C that we use in order to perform different mathematical
operations.
For example, this C statement is composed of five tokens.
4. Comments
A comment is a simple text that makes the code more descriptive and readable. You should include
comments in your code just to clarify how the code works. Comments are not mandatory in the
code; you may add them at your convenience.
Single Line–for a single line comments, symbols // is used before the comment line.
Multi-line– symbols used in multi-line comments are, /**/, the statement of the comment
should be enclosed within /* and */.
5. Whitespaces
Whitespace is a term that indicate blanks, tabs, characters and comments in C program. It serves as a
division between two elements of a statement that would help the compiler identify and decide where one
elements end and the next element starts in a statement. For example
1. Semicolons
Semicolons are provided to terminate the statement. A Semicolon indicates the start and end of the statement
execution. The semicolon will generate a “Compilation Error” if it is not provided. For example, the following
two statements:
int input;
printf(“Hello World”);
Rules in C Program
1. C is a case sensitive language. Most of the program statements are in lowercase.
2. All statements must necessarily terminate with a semicolon.
3. Whitespaces should be provided only between variables and keywords.