Chapter 1: Basic of Programming: What Is Program?
Chapter 1: Basic of Programming: What Is Program?
Chapter 1: Basic of Programming: What Is Program?
What is program?
A finite set of precise & clear instructions given to a computer to achieve a desired
result.
Programming languages: C, C++, C#, JAVA, PASCAL, ADA, ALGOL, LOGO, LISP,
COBOL, FORTRAN etc.
NEED OF COMPILER:
Computers neither understand English, Hindi, Gujarati, nor does it understand any of
the programming languages, it only understand 1 and 0. So to converter a program
(source code) into 1 and 0 a special translator program is used called compiler. It
converts source code into machine understandable language (1, 0) known as object
code (obj file). The object code is then linked if need with library functions giving
executable word (exe.file). The process of linking is done by a program called linker
and than a program called loader, loads the program in memory along with the data
required to give us the output. Fig1.2 shows the process of getting output.
Circle
connector
5] Dry run
6] Code the program
7] Test & debug the program
8] Documentation user manual
Technical manual
9] Maintenance & upgrade
STRUCTURE OF C PROGRAM
Documentation
Symbolic constant definition
File include section
Global variable declaration
Main( )
{
Declarations;
------------Executable statement;
-------}
Function 1 ( )
{
}
Function 2 ( )
{
}
Function n ( )
{
}
MY FIRST PROGRAM
#include<stdio.h> // include information about standard library //
main() // defined to be function that expects no arguments, which is indicated by the
empty list() //
{
Printf(PARIMAL); // printf function with argument PARIMAL, it also called string
constant
MY SECOND PROGRAM
Demonstrate use of \n,\t, clrscr(), getch()
#include<stdio.h>
Void main( )
{
clrscr( ); //clear screen//
printf(PARIMAL);
printf(\n\n\n\n\t\t SRLIM);
getch(); //direct only for o/p//
}
HISTORY OF C
The origin of c has been dated back to 1972 in Bell Laboratory by Dennis.M.Ritchie.
It was derived from BCPL (Basic Combined Programming languages). It was
standardised in 1989 by American National Standard Institute (ANSI).
Features of C
1] C is a structured language. It allows program to be broken into small pieces
known as functions. These functions once generated are reusable. A set of such
functions then becomes a C program.
2] C is portable language means C program can be run in different OS and compiler
with negligible modification.
3] C is middle level language. It is combination of high level and low level
programming.