Professional Documents
Culture Documents
Lesson 2:
C Language Overview-Part1
Prepared by:
Prof. Marienel N. Velasco
Unit
Pg. 1
I’m going to talk about
vIntroduction to C
vPractice Exercise on C
Unit
Pg. 2
Introduction to C
Ken Thompson
The developer of UNIX. • C is a general-purpose programming language developed by
B Dennis Ritchie at Bell Laboratories in 1972.
An assembler and a
language used by Ken • C was first used as the system language for the UNIX OS
Thompson to produced
initial versions of UNIX in
1970. • C evolved from B and BCPL.
BCPL
Language developed by • ANSI C or standard C, is a mature general-purpose language
Martin Richard in 1967 that is widely available on many machines and in many
as a typeless systems operating systems.
programming language.
ANSI
American National
• ANSI C, is one of the chief industrial programming
Standard Institute languages of the world, and it is commonly found in collages
C++ and universities everywhere.
An object-oriented
programming language. • ANSI C, is the foundation for C++ Unit
Pg. 3
How to write and run a C program?
Compiler STEPS:
translate source
code to object code
1. Find a Compiler for Windows user use
that is executable. (MinGW, GCC or Xcode) or IDE (Dev C++).
Operating System For Mobile phone user use Cxxdroid app.
manages machine
resources, provides
software for the 2. Type the codes in a text editor (notepad ++)
user, and act as or the Dev C++
interface between
the user and the
hardware. 3. Save your file into .c extension.
APPLICATIONS USED
Program#1:
DEV C++
• This program prints on the screen the phrase “from sea to
shining C”. Below is the complete program:
Function
A collection of
commands that “do • # include line causes the preprocessor to include a copy of the
something” header file stdio.h at this point in the code.
• The angle brackets around <stdio.h> indicate that the file is to be
found in the usual place, which is system dependent.
• This line tells the compiler that there is a function named main, and
that the function returns an integer.
• The keyword void indicates to the compiler that this function takes no
arguments.
• “Curly Braces” signal the beginning and end of functions and other
code blocks.
Unit
Pg. 6
Let’s analyze the code cont.
APPLICATIONS USED
Program#2:
DEV C++ • This program prints the same output as program #1, but
the phrase will printout in three lines.
APPLICATIONS USED
Program#3:
DEV C++ • This program is another variation of the two programs, one
that will box the phrase in a rectangle of asterisk.
APPLICATIONS USED
Program#4:
DEV C++ • This program uses getchar() function which wait the user to
hit enter thus prevents the window from closing.
• Including the above line gives you time to see the program run.
Unit
Pg. 12