Você está na página 1de 2

Computer Program

A computer program is a set of instructions written in a programming language to solve a


particular problem and achieve specific results. Any task performed by a computer is
controlled by a set of instructions or a computer program.

1.1 PROGRAMMING LANGUAGES

Programming languages fall in three broad categories, that is machine assembly and high
level languages.

1.1.1 Machine Language


Each type of computer has its own machine language which consists of zeros and ones.
No programming is done in machine language, instead assembly languages and high lecel
languages are used, the program must ultimately be converted to its machine language
equivalent, in machine language each operation such as addition and subtraction must be
defined explicitly furthermore ,programs written in machine language for one computer
will not work on another because of design differences.

1.1.2 Assembly Language


An assembly language allows the programmer to use all the computer features through
symbolic codes and locations than machine codes and binary however use of assembly
language requires comprehensive knowledge of how the computer works. Assembly
languages are used to free the programmer from most of the details of the machine
language. Before an assembly language program can be run on a computer, it must be
converted to machine language using a special program called assembler. In general
assembly language is termed one-to-one, that is, each assembly language instruction will
result in one machine language instruction.
Generally a program prepared in assembly language will require less storage and less
running time then one prepared in a high level language.

1.1.3 High Level Language


A HLL(High Level Language) is much more powerful programming tool than an
assembly HLL are English oriented languages in HLL one statement will produce a large
number of machine instructions. A special program known as compiler is used for
translating a high level language program into its machine language equivalent program.
High Level Languages are generally considered as problem oriented rather than machine
oriented.
One of the first HLLs to gain widespread acceptance was FORTRAN which stands for
Formula Translation. It was designed to write program for solving scientific and
engineering problems.
1.2 HISTORY OF C LANGUAGE

C language was developed in early 1970s by Dennis Ritchie at Bell Lab to implement the
UNIX Operating System on the PDP-11 manufactured by DEC( Digital Equipment
Corporation)
It was mainly used for writing system programs such as operating systems, compilers,
assemblers, word processor, spreadsheets and games etc.
It is highly structured language. C language programs are easy to understand and follow.
It is some times called mid level language since it combines some feature of low level
language and some of High Level Language.
C language has a small set of reserved words and the basic data types are simply integer,
floating point number and character. It does not have read and write statements like other
languages for performing input/output operations. These operations are performed by
means of functions provided in standard library.
American National Standard Institute (ANSI) introduced the standard version of C
language. Many software developers have adopted ANSI C for writing C compliers
which made C more portable. If the programs are not portable then program written on
one system cannot run on another and the programming efforts and time spent on the old
system would have been wasted.

1.3 BASIC STRUCTURE OF C LANGUAGE

The program may be written as follows:

#include<stdio.h>
void main(void)
{
printf(“Helper Public College Quetta”);
}

The # sign indicates that this is an instruction for the compiler. The <stdio.h> stands for
standard input-output header and the word include informs the C compiler to include the
declarations in the file stdio.h the user’s program.
A C program consists of one or more functions. C uses functions as the building blocks of
its program. A function performs a single well defined task. Every C program must have
the function main() which is the first sections to be executed when the program runs. The
word void before the function main() means that this function does not return a value and
the second void inside the brackets means it does not have any argument.
The body of the function is surrounded by braces ( ) The left brace indicates the start of
the function and right indicates the end of the function.
Printf is the standard output function. The text a semicolon (;)

CREATING, EDITING AND SAVING A PROGRAM

Você também pode gostar