Computer C
Computer C
• What is Programming?
• Why Programming?
• What are the significance?
What is Programming?
Programing is the process of creating a set of instruction
that tell a computer how to perform a task.
Programming can be done using a variety of computer
“languages” such as SQL, Java, Python , C# and C++.
Programming Language
C, C++, C#, java, Python
Instruction
Programmer OR
Programing
Computer
Why Programming?
Programing is important in our daily life to entrance and increase the
power of computer and the internet. programing is important for
speeding up the input and output processes in a machine. Programing
is important to automate, collect, mange, calculate, analyse the
processing of data and Information accurately.
High Level
Procedural
Assembly
Language
Low Level
Machine
Language
Programming Languages
Artificial Language.
Designed to communicate
instructions to a machine
Used to create programs that
control the behaviour of a
machine.
Program
Assembly
Language
Low Level
Machine
Language
Machine Language
Directly run on CPU.
Series of bits like, 0s and 1s.
Tedious and error prone to write
code manually.
01001110
Not Portable.
Assembly Language
Less error-prone.
Coding easier than machine language. Dim message, sapi MIPS
message =
Replaces 1 and 0s with English instructions. InputBox("A Free
x86
High Level Language
It is portable.
Statements are like English
Volid main()
language. {
Amount of abstraction provided int a=25
a””a + 25
defines level of programing
language. print(‘hello”):
}
Procedural Object Oriented
START()
I wake up
I brush my teeth
Object me
I open fridge Object
wake up () frigde
I take milk
brush () open ()
I want it in microwave
………. Object
close ()
microwave
……….
warm ()
BSke ()
……….
Procedural Object Oriented
Text Editor
How that program be converted to
Machine Language
Programing language Translators
Is a software which translate a program to machine
language
compiler
Programming Language
High Level
Language
Translator
Interpreter
Low Level
Language Assembler
Translator are programs that convert high level language
commands into set of machine code commands so that the
CPU can process the data!
1011,11001, 110001110 etc.
Compiler
Take the whole code and convert it into machine code before running.
Interpreter
Take the code one line at a time, translate and run the instruction, before
translating then ext instruction.
Assembler
The translator which can convert assembly language to machine language.
How to run the program?
Linker: A linker is a program which link the object code with the
library file to produce an executable file.
So what you need
Editor
Compiler
Linker
Debugger
IDE ( integrated Development Environment is an application software that
provide comprehensive facilities for computer programmer for software
development. It consists of (Editor, compiler, Linker & Debugger)
History of C/C++
1960 ALGOL-60 CAMBRIDGE University
1963 CPL Combine Programming Language.
1967 BCPL Basic Combine Programming Language by Martin Richards
1967 B Language by Ken Thomas “Bell Lab”
1972 C Dannis Richard
1989 ANSI America National Standard institute assign name to it C or
C89.
1990 ISO International Standard Organization Give Name C90.
1995 ISO Give Name C95
1999 Give Name C99
2011 C11
History of C/C++
C++ is derived from C language.
It is the Superset of C Language.
The C++ is the developed from of C.
C is a structure programming language but C++ is object oriented
Language.
Earlier C++ Known as C with Classes.
C++ expression are the same as C Expression. Ex: a=a+1 or 5>4
All C operators are valid in C++.Ex: ==,<,>
Most C++ program can be compiled in C Compiler.
DIFFERENCE BETWEEN C & C++
C is a procedural language. Is an object oriented language.
C was developed by Dennis Ritchie C++ was developed by Bjarne
between 1969 and 1973 at Bell Stroustrup in 1979 with C++’s
Labs for Unix Operating system. predecessor “c with Classes”.
No virtual functions is present. In 1983 they rename “C classes
No polymorphism is possible. with C++.
Overloading is not possible. Virtual Functions are present.
Ex: 3+3=6 here + is only use to add Polymorphism is possible.
two int number. Ex: Here the + operator can add
Multiple declaration of global two int, float or long and also add
variables are not allowed. two class object.
Multiple declaration of global
variables are allowed.
DIFFERENCE BETWEEN C & C++
In C language the scanf() function In C++ the cin>> function is used
is use for input. for input.
Printf() Function is used for output. Count<<function is used for output.
No inheritance is possible Inheritance is possible.
In C language exceptional handling In C++ exceptional handing is
is not possible. possible.
Difference between Program
and Package
Program :
Program, as name suggest, is collection of instructions written
in sequence that tells a computer what operation to perform
and produce result one want as well as solve problem,
increase creativity and improve performance.
Package :
Package, as name suggests, are simply set of program files,
data files, etc. developed by programmers to perform specific
task and include information regarding installation of packages.
Difference between Program and Package :
Programs are set of instructions
behind particular application or Packages are set of software
software. programs.
Programs are something that These are multiple pieces of
provide instruction to computer to software.
perform particular task. Packages are something that is
Program is especially developed by packed.
highly skilled programmer i.e. It is a special method of distributing
single programmer. and installing software to computer.
Programs are easy to develop and Package is especially developed
requires less time as compared to by group of programmers i.e. more
packages i.e. few hours or minutes. than one programmer.
Programmers need knowledge of Packages are not easy to develop
programming languages to develop and require more time to develop
program but not that much as than program i.e. weeks or
compared to develop packages. months..
C programing is a general-purpose, procedural computer
programming language originally developed at AT&T Bell Labs
by Dennis Ritchie in the early 1970s.
Most Popular Features of C Language.
• Simple and Efficient
• Fast
• Portability
• Function-Rich Libraries
• Mid-Level Programming Language
• Pointers
• Recursion
C language provides the feature of recursion. Recursion means that you can
create a function that can call itself multiple times until a given condition is
true, just like the loops. Recursion in C programming provides the functionality
of code reusability and backtracking.
What is the basic structure of a C++ program?
Structure of a C++ program
A C++ program is structured in a specific and particular manner. In C++, a
program is divided into the following three sections:
Standard Libraries Section
Main Function Section
Function Body SectionPointers
For example, let’s look at the implementation of the Hello World program:
Standard libraries section
• The file <iostream>, which is a standard file that should come with the C++
compiler, is short for input-output streams. This command contains code for
displaying and getting an input from the user.
• This code is saying: Use the cout and endl tools from the std toolbox.
• Main function section
• The name cout is short for character output and displays whatever is
between the << brackets.
• Symbols such as << can also behave like functions and are used with the
keyword cout.
• The return keyword tells the program to return a value to the function int
main
• After the return statement, execution control returns to the operating system
component that launched this program.
• Execution of the code terminates here.
Advantages and Disadvantages of of Language
Advantages of C Language
• C language is a building Blocks for many other
Language.
• C Language has variety of datatypes and powerful
operator.
• C is highly portable language
• There are only 32 keywords
• C has ability to extend itself.
• C is a structured programing language.
Advantages and Disadvantages of of Language
Disadvantages of C Language
• C does not have concept of object oriented programing languages.
Alphabets
Alphabets are represented by A-Z or a-z. C- Language is case sensitive
so it takes different meaning for small and upper case letters. By using
this character set C statements and character constants can be written
very easily. There are total 26 letters used in C-programming.
Digits
Digits are represented by 0-9 or by combination of these digits. By using
the digits numeric constant can be written easily. Also numeric data can
be assigned to the C-tokens. There are total 10 digits used in the C-
programming
Special Symbols
All the keyboard keys except alphabet, digits and white spaces are the special
symbols. These are some punctuation marks and some special symbols used
for special purpose.
There are total 30 special symbols used in the C-programming. Special symbols
are used for C-statements like to create an arithmetic statement +, -, * etc. , to
create relational statement <, >, <=, >=, == etc. , to create assignment
statement =, to create logical statement &&, II etc. are required.
White Spaces
White spaces has blank space, new line return, Horizontal tab space, carriage
ctrl, Form feed etc. are all used for special purpose. Also note that Turbo-C
Compiler always ignore these white space characters in both high level and low
level programming.