C PROGRAMMING
BASICS
DR. THERESA-SAMUELLE ADJAIDOO
2
“ Programming isn't about what
you know; it's about what you
can figure out.
CHRIS PINE ”
C PROGRAMMING - INTRODUCTION
3
• COMPUTER
PROGRAMMING
OUTLINE • WHAT IS C?
• WHY LEARN C?
C PROGRAMMING - INTRODUCTION
4
COMPUTER PROGRAMMING
u Computer programming can be described as the art of
telling a computer what to do through a set of
instructions.
u These written set of instructions are known as Computer
Code or (just) Code
u So programming is also known as coding
u To Code you need an appropriate programming
language
C PROGRAMMING - INTRODUCTION
5
COMPUTER PROGRAMMING
u A programming language is any language which
expresses a set of detailed instructions for a computer.
u Programming languages can be used to create
programs that implement specific algorithms.
u Algorithms are a finite sequence of steps which are
followed in solving a particular problem
C PROGRAMMING - INTRODUCTION
6
COMPUTER PROGRAMMING
u There are basically two categories of programming
languages.
1. Low Level Languages
u Machine
u Assembly Languages
2. High-Level Languages
C PROGRAMMING - INTRODUCTION
7
COMPUTER PROGRAMMING
u The machine code/language, contains a series of
binary codes that are understood directly by a
computer's CPU.
u Machine language is not designed to be human
readable.
u Assembly language contains a list of basic instructions
and is much more difficult to read than a high-level
language.
C PROGRAMMING - INTRODUCTION
8
COMPUTER PROGRAMMING
u High-level language: instruction set is more compatible
with human languages and human thought processes.
u High-level languages are designed to be easily read
and understood.
u This allows programmers to write source code using
logical words and symbols.
C PROGRAMMING - INTRODUCTION
9
COMPUTER PROGRAMMING
u Further Reading:
u Research examples of high-level languages
u A program written in high-level language must be
translated into machine language before it can be
executed.
u This is known as compilation or interpretation,
depending on how it is carried out.
C PROGRAMMING - INTRODUCTION
10
COMPUTER PROGRAMMING
u An Interpreter is a program that translates programming
language instructions one line at a time.
u A Compiler works by translating the entire program at
one time.
u Languages like C, C++ and Java are called "compiled
languages" since the source code must first be
compiled in order to run.
C PROGRAMMING - INTRODUCTION
11
COMPUTER PROGRAMMING
u Generally, compiled languages are used to create
software applications, while interpreted languages are
used for running scripts, such as those used to generate
content for dynamic websites.
u Further Reading:
u Research examples of compiled languages and interpreted
languages.
u Read on the differences between compilers and interpreters
C PROGRAMMING - INTRODUCTION
12
WHAT IS C?
u C is closely associated with Unix Operating system
u The developers of Unix Operating system (including
Dennis Ritchie and Stephen C. Johnson) decided to
rewrite the system in B language.
u However, B couldn’t suffice some of the features of that
PDP-11 version of Unix, which led to the development of
C.
C PROGRAMMING - INTRODUCTION
13
HISTORY OF C PROGRAMMING
u In 1972, the development of C started on the PDP-11
Unix system.
u A large part of Unix was then rewritten in C.
u By 1973, C was powerful enough to be used in Unix
Kernel.
u Dennis Ritchie and Stephen C. Johnson made further
changes to the language for several years to make it
portable in Unix Operating system.
C PROGRAMMING - INTRODUCTION
14
WHY LEARN C?
u Learning C makes the inner workings of a computer
more understandable thus providing a clear mental
model of how the computer works.
u C is the lingua franca of programming. Almost all high-
level programming languages like Java, Python,
JavaScript etc. can interface with C programming.
C PROGRAMMING - INTRODUCTION
15
WHY LEARN C?
u Learning C provides one with the opportunity and
capability to work on open source projects that impact
millions of people.
u This is so because most high-level programming
languages (e.g. Python) were birthed from C. Thus, C is
the main backbone on which they ride.
u Therefore to contribute to how these other
programming languages work, one must learn C.
C PROGRAMMING - INTRODUCTION
16
WHY LEARN C?
u Most programming languages use a similar syntax to C.
u Therefore by knowing how to code in C you would get
a head start in learning these other programming
languages (e.g. C++, C#, Javascript and PHP)
C PROGRAMMING - INTRODUCTION
17
WHY LEARN C?
u It is also important to know that C can be used in
programming most microprocessor based systems.
u The world of robotics, artificial intelligence and
embedded systems thrive heavily on efficient programs
written in C.
u Further Reading: Read on real-world applications of C
programming language
C PROGRAMMING - INTRODUCTION
18
THE END
Any Questions?
Contact: [email protected] or [email protected]
C PROGRAMMING - INTRODUCTION