Introduction To C Programming
Introduction To C Programming
Introduction To C Programming
SCP1103 (02)
DR MASITAH GHAZALI
FSKSM N28-306-06
masitah@utm.my
Course Information
• Refer to course outline (L1)
1 INTRODUCTION TO
COMPUTERS AND
PROGRAMMING
Why program?
Computer – programmable machine designed to
follow instructions
Program – instructions in computer memory to
make it do something
Programmer – person who writes instructions
(programs) to make computer perform a task
1011010000000101
– High-level: closer to
human language
Some well-known programming
languages
From a high-level program to an
executable file
a) Create file containing the program with a text editor.
b) Run preprocessor to convert source file directives to source
code program statements.
c) Run compiler to convert source program into machine
instructions.
d) Run linker to connect hardware-specific code to machine
instructions, producing an executable file.
• Steps b–d are often performed by a single command or
button click.
• Errors detected at any step will prevent execution of
following steps.
From a high-level program to an
executable file
Source Code Object Code
Preprocessor Linker
Compiler
Integrated Development
Environments (IDEs)
• An integrated development environment, or
IDE, combine all the tools needed to write,
compile, and debug a program into a single
software application.
• Examples are Microsoft Visual C++, Borland
C++ Builder, CodeWarrior, etc.
Integrated Development
Environments (IDEs)
What is a program made of?
• Common elements in programming
languages:
– Key Words
– Programmer-Defined Identifiers
– Operators
– Punctuation
– Syntax
– Variables
Sample C code
#include <stdio.h>
int main(void) {
printf("hello, world\n");
return 0;
}
Input, processing and output
Three steps that a program typically performs:
1) Gather input data:
• from keyboard
• from files on disk drives
2) Process the input data
3) Display the results as output:
• send it to the screen
• write to a file
The programming process
Procedural and object-oriented
programming
• Procedural programming: focus is on the
process. Procedures/functions are written to
process data.
• Object-Oriented programming: focus is on
objects, which contain data and the means to
manipulate the data. Messages sent to
objects to perform operations.