Professional Documents
Culture Documents
Engineers
Topic 1: Introduction to Computer and Programming
Objectives
In this chapter you will learn about:
Overview of PC components
Computer Software
C programming language
C program at a glance
Overview of PC Component
Computer Hardware Components
Input / Output Devices
Input Device
1s and 0s
Accepts information
Information
from the user and
transforms it to digital
codes that the
computer can process
Input / Output Devices
Output Device
1s and 0s
Information
An interface by which
the computer conveys
the output to the user
Memory
Memory cells: individual storage
location in memory
Address: the relative position of a
memory cell in the computers main
memory
Contents: the information stored in a
memory cell
Computer only understands binary
digits- bits (1 or 0). Hence, the content
stored are actually bits. Bit
myprog.obj
myprog.exe
Steps for high level programming
Some computers require users to ask OS to carry out
the steps separately
But most high-level language compilers comes as part
of an Integrated Development Environment (IDE)
IDE: software package combining a word processor,
compiler, linker, loader, and tools for finding errors
Example C IDE: Code::Blocks, Dev-C++
IDE Example (Code::Blocks)
C Programming Language
C Programming Language
Developed by Dennis Ritchie at Bell Laboratories
in the 1972
In cooperation with Ken Thomson it was used for
Unix systems
The C Language was only vaguely defined, not
standardized, so that almost everyone had his own
perception of it, to such an extend that an urgent
need for a standard code was creeping up
C Programming Language
In 1983, the American National Standards
Institute (ANSI) set up X3J11, a Technical
Committee to draft a proposal for the ANSI
standard, which was approved in 1989 and
referred to as the ANSI/ISO 9899 : 1990 or
simply the ANSI C, which is now the global
standard for C.
This standard was updated in 1999; but
there is no compiler yet
C Program at a Glance
Elements of C
preprocessor directive a C program line beginning with #
that provides an instruction to the preprocessor
preprocessor a system program that modifies a C program prior to
its compilation
library a collection of useful functions and symbols that
may be accessed by a program
Function main main function where program execution
begins (every c program has one)
declarations the part of a program that tells the compiler
the names of memory cells in a program
Executable statements program lines that are converted
to machine language instructions and executed by the
computer
Reserved words words that has special meaning in C
etc
A Simple Program in C
#include <stdio.h>
int main()
{
printf("I like programming in C.\n");
return 0;
}
A Simple Program in C - explanation
Preprocessor directive
#include <stdio.h>
standard Library, input-output, header-file
Begin of program
int main()
{ Start of Segment
} End of Segment
C Output
I like programming in C.
Why learn programming?
Why learn programming?
Programming
References
Hanly and Koffman, Problem Solving and Program
Design in C
The internet
Appendices
ANSI C Reserved Words
auto double int struct
break else long switch
case enum register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while