Intro To C-Module-1
Intro To C-Module-1
Introduction to C
Programming
Subject Code :22BESCK104E/204E
Module-1 Topics
1.1 Computer
1.2 Characteristics of Computers
1.3 Stored Program Concept
1.3.1 Types of Stored Program Computers
1.4 History of Computers
1.5 Classification of Computers
1.5.1 Supercomputers
1.5.2 Mainframe Computers
1.5.3 Minicomputers
1.5.4 Microcomputers
1.6 Applications of Computers
1.7 Basic Organization of a Computer
1.8 Lab Session—Inside the Computer
1.9 Motherboard
1.9.1 Characteristics of a Motherboard
Module-1 Topics
1.1 Computer
1.2 Characteristics of Computers
1.3 Stored Program Concept
1.3.1 Types of Stored Program Computers
1.4 History of Computers
1.1 Computer
Generations of Computers :
Apple Mac OS and MS DOS were also released during this period.
Uses : Used for Scientific, commercial, interactive online, and
network applications
Examples : IBM PC, Apple II, TRS-80, VAX 9000, CRAY- 1, CRAY-
2, CRAY-X/M
Fifth Generation of Computers (1989-Present)
Dumb Terminals :
Dumb terminals consist of only a monitor and a keyboard (or
mouse).
They do not have their own CPU and memory and use the
mainframe system’s CPU and storage devices.
Intelligent Terminals :
Intelligent terminals have their own processor and thus can
perform some processing operations.
They do not have their own storage space.
Usually, PCs are used as intelligent terminals to facilitate data
access and other services from the mainframe system.
1.5.3 Mini Computers
Mini Computers :
Minicomputers are smaller, cheaper, and slower than mainframes.
They are also known as midrange computers .
The capabilities of minicomputers fall between mainframe and
personal computers.
Minicomputers are widely used in business, education, hospitals,
government organizations, etc.
Some minicomputers can be used only by a single user, others are
specifically designed to handle multiple users simultaneously.
Minicomputers can also be used as servers in a networked
environment, and hundreds of PCs can be connected to it.
1.5.4 Micro Computers
Micro Computers :
Microcomputers, commonly known as PCs, are very small and
cheap. The first microcomputer was designed by IBM in 1981 and
was named IBM-PC.
PCs can be classified into the following categories:
Desktop PCs
Laptops
Workstations
Networked Computers
Handheld Computers
1.5.4 Micro Computers
Desktop PC :
Desktop PC is the most popular model of PCs.
It can be placed on the flat desk or a table
It is used mainly in homes and offices.
Laptops :
Laptops are small microcomputers that can easily fi t inside a
briefcase.
They are very handy and can easily be carried from one place to
another.
The memory and storage capacity of a laptop is almost equivalent
to that of a desktop computer.
1.5.4 Micro Computers
Workstations :
Workstations are single-user computers that have the same
features as PCs, but their processing speed matches that of a
minicomputer or mainframe computer.
Workstation computers have advanced processors, more RAM and
storage capacity than PCs.
They are more expensive and powerful than a normal desktop
computer.
They are widely used as powerful single-user computers by
scientists, engineers, architects, and graphic designers, they can
also be used as
1.5.4 Micro Computers
Network Computers :
Network computers have less processing power, memory, and
storage than a desktop computer.
These are specially designed to be used as terminals in a
networked environment.
For example, some network computers are specifically designed
to access data stored on a network servers in a networked
environment.
Network computers that are specifically designed to access only
the Internet or intranet are often known as Internet PCs or Internet
boxes.
1.5.4 Micro Computers
Handheld :
The mid-1990s witnessed a range of small personal computing
devices that are commonly known as handheld computers, or
mobile computers. These computers are called handheld
computers .
They are called Handheld computers because they can fit in one
hand, while users can use the other hand to operate them.
Handheld computers are very small in size, and hence they have
small-sized screens and keyboards.
These computers are preferred by business travellers and mobile
employees
1.6 Applications of Computers
Word processing : This software enables users to read and write the
documents and insert the images ,tables and graphs for illustrating
the concepts.
Internet :The Internet is a network of networks that connects
computers all over the world. It gives the user access to an enormous
amount of information, much more than available in any library.
Digital video or audio composition: Computers make audio or
video composition and editing very simple. This has drastically
reduced the cost of equipment to compose music or make a film.
1.6 Applications of Computers
Primary Storage :
Primary Storage is also known as main memory
Primary storage is directly accessible by the CPU at very high
speeds.
It is used to store the data and parts of programs, the
intermediate results of processing, and the recently generated
results of jobs that are currently
being worked on by the computer.
Primary storage space is very expensive and therefore limited in
capacity.
Primary storage is volatile memory.
Basic Organization of a Computer
Secondary Storage :
Primary Storage is also known as aauxiliary memory.
It is used to store the permanently data and parts of programs,
of jobs that are currently being executed on by the cpu.
Secondary storage space is cheap.
Secondary storage is non-volatile memory.
Example of secondary memory is Hard disk.
Output : Output is the process of giving the result of data
processing to the outside world (external to the computer system).
The results are given through output devices such as monitor, and
printer.
Basic Organization of a Computer
Control : The control unit (CU) is the central nervous system of the
entire computer system. It manages and controls all the components
of the computer system.
It is the CU that decides the manner in which instructions will be
executed and operations performed.
It takes care of the step-by-step processing of all operations that
are performed in the computer.
CPU is a combination of the arithmetic logic unit (ALU) and the
CU.
The CPU is known as the brain of the computer system because
the entire processing of data is done in the ALU, and the CU
Basic Organization of a Computer
Video Card : The video card is a board that plugs into the
motherboard of the computer and generates images for display.
Many video cards these days have their own RAM and processor to
enhance the speed of the graphics display. Many computers come
with an in-built video chip.
Modem : A modem (modulator–demodulator) is a device that
enables the computer to use a telephone line to communicate and
connect to the Internet.
Network Card : A network card is used to connect the computer
either to other computers or to the Internet.
Lab Session : Inside the Computer
Fans : Fans are used to allow air inside and cool the computer.
Cables : There are multiple wires inside the computer that are fl
at, ribbon-like cables. They are used to provide power and
communication to the various parts inside the computer.
Sound Card : sound cards are expansion boards that are used to
enable a computer to manipulate sound. For example, sound cards
allow the users to plug in speakers and a microphone. Some sound
cards also provide the jacks for hooking your computer up to a
common stereo.
Day-3
1.9 Mother Board
1.9.1 Characteristics of Motherboard
1.10 Input Devices
1.10.1 Keyboard
1.10.2 Pointing Devices
1.10.3 Handheld Devices
1.10.4 Optical Devices
1.10.5 Audiovisual Input Devices
1.11 Output Devices
1.11.1 Soft Copy Devices
1.11.2 Hard Copy Devices
1.12 Programming Paradigms
1.12.1 Monolithic Programming
1.12.2 Procedural Programming
1.12.3 Structured Programming
1.12.4 Object-oriented Programming (OOP)
1.9 Mother Board
Motherboard:
The motherboard, also known as the mainboard or the parent
board.
Motherboard is the primary component of a computer.
It is used to connect all the components of the computer.
The motherboard is a printed circuit that has connectors for
expansion cards, memory modules, the processor, etc.
1.9.1 Characteristics Mother Board
Programming Paradigms :
Programming paradigm is the style or way of programming.
It defines how the programming structure and basic elements of
the computer program will be built.
Each programming paradigm has its own strength and weakness
and no single paradigm can suit all applications.
Different types of programming paradigm are :
Monolithic Programming
Procedural Programming
Structured Programming
Object-oriented Programming (OOP)
1.12.1 Monolithic Programming
Monolithic Programming :
Monolithic programming has only one programming module.
It does not support the concept of subroutines.
This type of programming paradigm consists of global data and
sequential
code.
This type of paradigm focuses/emphasizes on finding only the
solution to
the problem.
All the actions required to complete the task are embedded in one
single
application itself.
Since all the actions are embedded into single application the size
of the program becomes large and becomes difficult to debug and
maintain.
All the instructions are executed in sequence . In order to change
1.12.2 Procedural Programming
Procedural Programming :
In procedure language, the program is divided into subroutines
(functions).
Each subroutine performs a well defined task.
If a subroutine needs a service from another subroutine then the
subroutine can call that subroutine that provides the service.
In procedural programming paradigm the sequence of execution
of the program can be altered.
FOTRON and COBAL are the two popular procedural
programming languages
1.12.3 Structural Programming
Structural Programming :
Structural programming is also called as modular programming.
Structural programming was basically defined to be used in large
programs.
Structural programming employs top-down approach in which
overall program structure divided into modules.
Modules are coded separately and once the module is written and
tested individually .it is then integrated with other modules to form
the overall program structure.
Each modules has its own local data and also use the global data.
Structural programming groups the related logical statements into
modules.
Modularization makes it easy to write, debug and understand the
program.
Modern programming languages such as c and Pascal support the
concept of structural programming
1.12.4 Object Oriented Programming
Linker Errors: These errors occur when the linker is not able to find
the function definition for a given prototype. For example, if you
write clrscr(); but do not include conio.h then a linker error will be
shown. Similarly, even if you have defined a function
display_data() but while calling if you mistake and write
displaydata() then again a linker error will be generated.
Day-5
Link Section: All header files are included in this section which
contains different functions from the libraries. A copy of these
header files is inserted into your code before compilation.
main() : For every c program ,the execution starts from the main()
function. It is mandatory to include the main() function in every c
program.
Single-line Comments
Single-line comments start with two forward slashes (//).
Any text between // and the end of the line is ignored by the
compiler (will not be executed).
Example:
Example:
Tokens are the building blocks or the very basic components used
in creating any program in the C language.
Data type : specifies the type and size of data associated with the
variable
Exanple:
int x;
Where
• formatting string is one of the format specifer each format specifer
starts with
%.
•var1,var2,……varn are the values of the variables vr1,var2,
Formatting Input/output
Examples Formatted Output using printf( ) :
Example1:
int a=10,b=20;
printf ( “a=%d and b=%d”, a,b); // output a=10 and b =20
Example2:
float a=12.5;
double b=23.8;
char x = ‘S’;
long int m = 12344567;
printf( “ a= %f \n b=%ld\n x=%c\n m=%ld”, a,b,x,m);
Output:
a=12.500000
b=23.80000000
x= S
m = 12344567
1.31.2 Formatting Input/output
Formatted Input using scanf( ) :
We can store the data into the memory from input devices (such as
keyboard) using the scanf() function in C
Syntax:
scanf( “formatting-string”, &var1,&var2,……,&varn);
Where
• formatting string is one of the format specifer each format specifer
starts with
%.
•&var1,&var2,……&varn are the address of the variables vr1,var2,
Formatting Input/output
Examples Formatted Output using printf( ) :
Example1:
int a=10,b=20;
scanf ( “%d %d”, &a,&b);
Example2:
float a=12.5;
double b=23.8;
char x = ‘S’;
long int m = 12344567;
scanf( “%f%ld%c%ld”, &a,&b,&x,&m);
Thank You