2. Program
• Program
A program is a logical pattern of
instructions to solve a problem.
• Programming
Programming refers to the creation of a list
of stored instructions that tell the computer
what to do.
Free tutorials Visit to code @ www.codemodes.com Free Projects
3. What is a programming
language?
• Media of communication between Human and
Machine( Computer).
Free tutorials Visit to code @ www.codemodes.com Free Projects
4. Why Programming Languages ?
• Suppose for a moment that you were given the
following list of instructions to perform :
1. 0001 0011 0011 1011
2. 1101 0111 0001 1001
3. 1111 0001 1101 1111
4. 0000 1100 0101 1101
5. 0001 0011 0011 1011
Free tutorials Visit to code @
www.codemodes.com
Free Projects
5. Programming Languages
• Programming languages provide us a plate
form to describe the job of computer through
instructions.
• All the programming languages are divided
into two categories
1. High level languages or Problem oriented
languages
2. Low level languages or Machine oriented
languages
Free tutorials Visit to code @ www.codemodes.com Free Projects
6. High-level languages
• These languages are designed to give a
better programming efficiency, i.e. faster
program development.
• These languages are human readable.
• It is easy to work in this type of a language.
• Easy to write a program in high level
language.
• e.g. Cobol, Fortran, Java, Visual Basic.
• Slower than low level language
Free tutorials Visit to code @ www.codemodes.com Free Projects
7. Fortran and Cobol
• FORTRAN stands for formula translation
• Used to design applications to solve scientific
problems
– COBOL: stands for Common Business
Oriented Language
• It was used to design applications for business and
banks to generate invoices, keep records of
inventory and generate reports etc.
Free tutorials Visit to code @ www.codemodes.com Free Projects
8. Low-level languages
• These languages are designed to give a better
machine efficiency, i.e. faster execution.
• These type of languages are also called
machine language
• These languages are based on machine code.
• Also called the language of microprocessor.
• Hard to learn and write a program in low level
language.
• e.g. Assembly language, machine language,
Sys 3800, MAC.
Free tutorials Visit to code @ www.codemodes.com Free Projects
9. Machine Language
• A language that is directly understandable by
machines
• Machine language consists of 1 and 0
• It does not need any kind of translation or
compiler
• Very tough to learn and code
Free tutorials Visit to code @ www.codemodes.com Free Projects
10. Assembly Language
• An assembly language is a low-level programming
language for microprocessors and other programmable
devices.
• An assembly language implements a symbolic
representation of the machine code needed to program
a given CPU architecture.
• Using assembly language you can access all features
of a computer or you can directly interact with
hardware.
• Assembler: A software that is used to translate
assembly language to machine language.
Free tutorials Visit to code @ www.codemodes.com Free Projects
11. C Language
• C is a high level programming languages.
• C is widely used for professional programming.
• C combines the virtues of high-level
programming languages with the efficiency of
assembly languages. Using C programmers can
directly manipulate bits of data inside the
processing unit. As a result C programs run
significantly faster than programs written in other
languages. That is why it is often called a middle
level language
Free tutorials Visit to code @ www.codemodes.com Free Projects
Free tutorials Visit to code @ www.codemodes.com Free Projects
12. A language is a language
• Programming languages are languages.
• When it comes to the mechanics of the task,
learning to speak and use a programming
language is in many ways like learning to speak
a human language.
• In both kinds of language you have to learn new
vocabulary, syntax and semantics (new words,
sentence structures and meanings).
• And both kinds of language require considerable
practice to make perfect.
Free tutorials Visit to code @ www.codemodes.com Free Projects
13. A brief history of C
• C came into being in the years 1969-1973, in
parallel with the early development of the Unix
operating system by Dennis Ritchie at Bell
Laboratory.
14. The C family tree
• C evolved into a language, it did not
simply appear.
• C has many descendants
– Concurrent C, Objective C, C++, C#
– C++ is an object-oriented derivative of C
with “classes“, inheritance, polymorphism,
encapsulation, data hiding, reusability, etc.
Free tutorials Visit to code @ www.codemodes.com Free Projects
15. Why use C?
• C is often called a “middle-level” language
– High-level languages provide everything the
programmer might want to do already built into
the language.
e.g. Fortran
– A low level language provides nothing other
than access to the machines basic instruction
set.
e.g. assembler
– A middle level language, such as C, probably
doesn't supply all the constructs found in high-
languages – but it provides you with all the
building blocks that you will need
Free tutorials Visit to code @ www.codemodes.com Free Projects
16. What is an Instruction ?
The command, task or job that CPU
understands and is capable to execute
Free tutorials Visit to code @ www.codemodes.com Free Projects
17. What is a Program
A set of step by step instructions that
directs a computer to perform specific
tasks and produce certain results.
Free tutorials Visit to code @ www.codemodes.com Free Projects
18. Programming
Programming refers to the creation of a list
of stored instructions that tell the
computer what to do.
2+2
2*3
5+5
Free tutorials Visit to code @ www.codemodes.com Free Projects
19. An overview of C programming
• A C program is composed of one or more
“source files”, each of which contains
some part of an entire C program
– Common declarations are often collected into
“header files”
Free tutorials Visit to code @ www.codemodes.com Free Projects
20. The Programming Process
• Programs must be translated into the
target computers machine language.
– compiler: program that does the translation
– source file: the input into the compiler
– If the program is syntactically correct, the
compiler saves the machine language
instructions in an object file.
– The linker combines an object file with
preexisting libraries of functions and produces
an executable file
Free tutorials Visit to code @ www.codemodes.com Free Projects
21. The Programming Process
• The programming process consists of a
cycle.
edit compile run
Free tutorials Visit to code @ www.codemodes.com Free Projects
22. A basic C program
#include <stdio.h>
void main(void)
{
printf(“Code Modes!n”);
}
Free tutorials Visit to code @ www.codemodes.com Free Projects
23. What’s happening here?
Void main(void)
{
printf(“Code Modes! n”);
}
this preprocessor
directive includes
the standard I/O
library
#include <stdio.h>
Free tutorials Visit to code @ www.codemodes.com Free Projects
24. What’s happening here?
#include <stdio.h>
{
printf(“Code Modes!n”);
}
main signifies
the start of the
program
Void main(void)
All C programs are divided
in to units called function.
The main( ) function is the
one to which control is
passed when the program
is executed.Free tutorials Visit to code @ www.codemodes.com Free Projects
25. What’s happening here?
#include <stdio.h>
Void main(void)
printf(“Code Modes!n”);
}
an opening curly
brace defines the
beginning of the
function{
Free tutorials Visit to code @ www.codemodes.com Free Projects
26. #include <stdio.h>
Void main(void)
{
}
What’s happening here?
printf(“Code Modes!n”);
the printf statement
prints the text on
screen
Free tutorials Visit to code @ www.codemodes.com Free Projects
27. What’s happening here?
#include <stdio.h>
Void main(void)
{
printf(“Code Modes!n”);
a closing curly
brace defines the
end of the function
}
Free tutorials Visit to code @ www.codemodes.com Free Projects
28. What is Function?
A block of code used to perform a specific
task.
#include <stdio.h>
Void main(void)
{
printf(“Code Modes!n”);
}
Free tutorials Visit to code @ www.codemodes.com Free Projects
29. The Basic Structure of C Programs
<stdio.h> Standard Input Out put header file.
include Key word called pre processor directive
#, <, >, {, } Special characters used for Syntax or
format.
void main(void) main function
printf a function which display output on
screen
“ Message Start
“ Message close
( ) Parenthesis.
; Statement terminator
IDE Integrated Development Environment
Free tutorials Visit to code @ www.codemodes.com Free Projects