SlideShare une entreprise Scribd logo
1  sur  19
Introduction to C
What is a program
• A sequence of instructions that a computer can
interpret and execute;
– If I tell you the way from IBA Academic Block to
IBA Administration Block … I will tell sequence of
instructions…. Any wrong instruction leads to a
undesired result.
• A program is something that runs on your computer.
In case of MS Windows program is of .EXE or .COM
extensions
• MS Word, Power point, Excel are all computer
programs
2
Aftab Ahmed Palh - Computer Science
Instructor
Introduction to C
• C is a statically typed, compiled, general-purpose,
case-sensitive, free-form programming language.
• It supports procedural, object-oriented, and generic
programming.
• C is regarded as a middle-level language, as it
comprises a combination of bot h high-level and low-
level language features
3
Aftab Ahmed Palh - Computer Science
Instructor
Introduction to C++ (Cont..)
• C++ was developed by Bjarne Stroustrup starting in
1979 at Bell Labs in Murray Hill, New Jersey.
• C++ is an enhancement to the C language and
originally named C with Classes but later it was
renamed C++ in 1983.
4
Aftab Ahmed Palh - Computer Science
Instructor
Introduction to C++ (Cont..)
Object- Oriented Programming
• C++ fully supports object-oriented programming,
including the four pillars of object-oriented
development:
• Encapsulation
• Data hiding
• Inheritance
• Polymorphism
5
Aftab Ahmed Palh - Computer Science
Instructor
The ANSI Standard
• The ANSI standard is an attempt to ensure that
C++ is portable -- that code you write for
Microsoft's compiler will compile without errors,
using a compiler on a Mac, UNIX, a Windows box,
or an Alpha.
Use of C++
.
• C++ is used by hundreds of thousands of
programmers in essentially every application
domain.
• C++ is being highly used to write device drivers
and other softwares that rely on direct
manipulation of hardware under real-time
constraints
Environment Setup
• Before you start doing programming using C++, you
need the following two softwares available on your
computer.
1. Text Editor
2. C++ Compiler
8
Aftab Ahmed Palh - Computer Science
Instructor
Environment Setup Cont…
• The files you create with your editor are called
source files, and for C++ they typically are named
with the extension .cpp
• C++ compiler, which will be used to compile your
source code into final executable program
9
Aftab Ahmed Palh - Computer Science
Instructor
Writing C++ Programs
• A programmer uses a text editor to create or modify
files containing C++ code.
• Code is also known as source code.
• A file containing source code is called a source file.
• After a C++ source file has been created, the
programmer must invoke the C++ compiler before
the program can be executed (run).
10
Aftab Ahmed Palh - Computer Science
Instructor
Compiler converts
human readable
language to a
language which is
understandable by
the operating
system/hardware
Examples of C/C++
compilers of today:
Visual C++
GCC/G++
DJGPP (open source
for windows like
GCC)
Borland C
Turbo (obsolete and
not recommended)
11
Aftab Ahmed Palh - Computer Science
Instructor
Program Development
Source File
Program Object Code File
Executable File
Preprocessor
Modified Source Code in RAM
Compiler
Linker
Other Object Code Files (if any)
Editor
12
Aftab Ahmed Palh - Computer Science
Instructor
A Simple C++ Program
#include <iostream.h> //This is preprosessor directive
int main ( ) //this tells the starting point of your program
{
cout << “Hello World” <<endl ; //print the text on monitor
return 0 ; //return to operating system
}
Note: cout is an object given to you by the creators of C++. This function saves you
From the complexity of writing your own function of how to display text on the computer
Screen. Hence you are more productive with the actual program rather than worrying
About such issues.
13
Aftab Ahmed Palh - Computer Science
Instructor
Elements of C+ Program
Preprocessor Directive
• Preprocessor Directive tells computer to load
contents of a certain file
• #include
14
Aftab Ahmed Palh - Computer Science
Instructor
Elements of C+ Program
Header file
• Header file contains the implementation code
of the c++ functions and c++ keywords.
• Iostream.h, conio.h, stdio.h
15
Aftab Ahmed Palh - Computer Science
Instructor
16
Elements of C+ Program
• int main()
– C++ programs contain one or more functions, exactly
one of which must be main
– Parenthesis used to indicate a function
– int means that main "returns" an integer value
– Braces { and } indicate a block
• The bodies of all functions must be contained
in braces
– Braces indicate the block of function in c++ program
Aftab Ahmed Palh - Computer Science
Instructor
17
Elements of C+ Program
• return 0;
– A way to exit a function
– return 0, in this case, means that the program
terminated normally
• Linker
– When a function is called, linker locates it in the
library
– Inserts it into object program
– If function name is misspelled, the linker will produce
an error because it will not be able to find function in
the library
Aftab Ahmed Palh - Computer Science
Instructor
18
Elements of C+ Program
• Parenthesis ()
• Parenthesis are used to declare function.
Example Int main()
• Cout
• Cout is a keyword which displays the result of
program on monitor screen
• Cout<<“hello”;
Aftab Ahmed Palh - Computer Science
Instructor
19
Elements of C+ Program
• Int
• Int is a data type of function or variable
• Semicolon ;
• Semicolon is used to end the program
statement.
• Program Statement
• Program statement or simply statement is the
instruction in c++ programming language
Aftab Ahmed Palh - Computer Science
Instructor

Contenu connexe

Tendances

Transpilers(Source-to-Source Compilers)
Transpilers(Source-to-Source Compilers)Transpilers(Source-to-Source Compilers)
Transpilers(Source-to-Source Compilers)Shivang Bajaniya
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programmingManoj Tyagi
 
Compiler interpreter and_bootstrapping
Compiler interpreter and_bootstrappingCompiler interpreter and_bootstrapping
Compiler interpreter and_bootstrappingsandeep manzhi
 
Object oriented programming 7 first steps in oop using c++
Object oriented programming 7 first steps in oop using  c++Object oriented programming 7 first steps in oop using  c++
Object oriented programming 7 first steps in oop using c++Vaibhav Khanna
 
Classification of Compilers
Classification of CompilersClassification of Compilers
Classification of CompilersSarmad Ali
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design BasicsAkhil Kaushik
 
Chapter One
Chapter OneChapter One
Chapter Onebolovv
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compilerIffat Anjum
 
Compiler Construction Course - Introduction
Compiler Construction Course - IntroductionCompiler Construction Course - Introduction
Compiler Construction Course - IntroductionMuhammad Sanaullah
 
Emscripten - compile your C/C++ to JavaScript
Emscripten - compile your C/C++ to JavaScriptEmscripten - compile your C/C++ to JavaScript
Emscripten - compile your C/C++ to JavaScript穎睿 梁
 
introduction to c language
 introduction to c language introduction to c language
introduction to c languageRai University
 

Tendances (20)

Transpilers(Source-to-Source Compilers)
Transpilers(Source-to-Source Compilers)Transpilers(Source-to-Source Compilers)
Transpilers(Source-to-Source Compilers)
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Compiler design
Compiler designCompiler design
Compiler design
 
Compiler interpreter and_bootstrapping
Compiler interpreter and_bootstrappingCompiler interpreter and_bootstrapping
Compiler interpreter and_bootstrapping
 
Object oriented programming 7 first steps in oop using c++
Object oriented programming 7 first steps in oop using  c++Object oriented programming 7 first steps in oop using  c++
Object oriented programming 7 first steps in oop using c++
 
Compilation
CompilationCompilation
Compilation
 
Classification of Compilers
Classification of CompilersClassification of Compilers
Classification of Compilers
 
Introduction to Compiler
Introduction to CompilerIntroduction to Compiler
Introduction to Compiler
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design Basics
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
 
Compiler design
Compiler designCompiler design
Compiler design
 
C PROGRAMMING
C PROGRAMMINGC PROGRAMMING
C PROGRAMMING
 
Chapter One
Chapter OneChapter One
Chapter One
 
C programming
C programmingC programming
C programming
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compiler
 
Compiler Construction Course - Introduction
Compiler Construction Course - IntroductionCompiler Construction Course - Introduction
Compiler Construction Course - Introduction
 
Compiler unit 1
Compiler unit 1Compiler unit 1
Compiler unit 1
 
Emscripten - compile your C/C++ to JavaScript
Emscripten - compile your C/C++ to JavaScriptEmscripten - compile your C/C++ to JavaScript
Emscripten - compile your C/C++ to JavaScript
 
introduction to c language
 introduction to c language introduction to c language
introduction to c language
 
Compiler Design Material
Compiler Design MaterialCompiler Design Material
Compiler Design Material
 

Similaire à Introduction to C Language

Whole c++ lectures ITM1 Th
Whole c++ lectures ITM1 ThWhole c++ lectures ITM1 Th
Whole c++ lectures ITM1 ThAram Mohammed
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programmingRokonuzzaman Rony
 
Basics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptxBasics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptxCoolGamer16
 
Synapseindia dot net development computer programming
Synapseindia dot net development  computer programmingSynapseindia dot net development  computer programming
Synapseindia dot net development computer programmingSynapseindiappsdevelopment
 
Introduction to cpp language and all the required information relating to it
Introduction to cpp language and all the required information relating to itIntroduction to cpp language and all the required information relating to it
Introduction to cpp language and all the required information relating to itPushkarNiroula1
 
C Programming UNIT 1.pptx
C Programming  UNIT 1.pptxC Programming  UNIT 1.pptx
C Programming UNIT 1.pptxMugilvannan11
 
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...bhargavi804095
 
Embedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals masterEmbedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals masterHossam Hassan
 
C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...bhargavi804095
 
Introduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxIntroduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxNEHARAJPUT239591
 
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJIntroduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJmeharikiros2
 

Similaire à Introduction to C Language (20)

Whole c++ lectures ITM1 Th
Whole c++ lectures ITM1 ThWhole c++ lectures ITM1 Th
Whole c++ lectures ITM1 Th
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
 
Basics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptxBasics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptx
 
C intro
C introC intro
C intro
 
Synapseindia dot net development computer programming
Synapseindia dot net development  computer programmingSynapseindia dot net development  computer programming
Synapseindia dot net development computer programming
 
C_Intro.ppt
C_Intro.pptC_Intro.ppt
C_Intro.ppt
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
Session 1 - c++ intro
Session   1 - c++ introSession   1 - c++ intro
Session 1 - c++ intro
 
lec 1.pptx
lec 1.pptxlec 1.pptx
lec 1.pptx
 
Introduction to cpp language and all the required information relating to it
Introduction to cpp language and all the required information relating to itIntroduction to cpp language and all the required information relating to it
Introduction to cpp language and all the required information relating to it
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
C++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.pptx
 
C Programming UNIT 1.pptx
C Programming  UNIT 1.pptxC Programming  UNIT 1.pptx
C Programming UNIT 1.pptx
 
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
 
Embedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals masterEmbedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals master
 
C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...
 
Introduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxIntroduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptx
 
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJIntroduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
 
Learn C Language
Learn C LanguageLearn C Language
Learn C Language
 
Prog1-L1.pdf
Prog1-L1.pdfProg1-L1.pdf
Prog1-L1.pdf
 

Dernier

8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburgmasabamasaba
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 

Dernier (20)

8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 

Introduction to C Language

  • 2. What is a program • A sequence of instructions that a computer can interpret and execute; – If I tell you the way from IBA Academic Block to IBA Administration Block … I will tell sequence of instructions…. Any wrong instruction leads to a undesired result. • A program is something that runs on your computer. In case of MS Windows program is of .EXE or .COM extensions • MS Word, Power point, Excel are all computer programs 2 Aftab Ahmed Palh - Computer Science Instructor
  • 3. Introduction to C • C is a statically typed, compiled, general-purpose, case-sensitive, free-form programming language. • It supports procedural, object-oriented, and generic programming. • C is regarded as a middle-level language, as it comprises a combination of bot h high-level and low- level language features 3 Aftab Ahmed Palh - Computer Science Instructor
  • 4. Introduction to C++ (Cont..) • C++ was developed by Bjarne Stroustrup starting in 1979 at Bell Labs in Murray Hill, New Jersey. • C++ is an enhancement to the C language and originally named C with Classes but later it was renamed C++ in 1983. 4 Aftab Ahmed Palh - Computer Science Instructor
  • 5. Introduction to C++ (Cont..) Object- Oriented Programming • C++ fully supports object-oriented programming, including the four pillars of object-oriented development: • Encapsulation • Data hiding • Inheritance • Polymorphism 5 Aftab Ahmed Palh - Computer Science Instructor
  • 6. The ANSI Standard • The ANSI standard is an attempt to ensure that C++ is portable -- that code you write for Microsoft's compiler will compile without errors, using a compiler on a Mac, UNIX, a Windows box, or an Alpha.
  • 7. Use of C++ . • C++ is used by hundreds of thousands of programmers in essentially every application domain. • C++ is being highly used to write device drivers and other softwares that rely on direct manipulation of hardware under real-time constraints
  • 8. Environment Setup • Before you start doing programming using C++, you need the following two softwares available on your computer. 1. Text Editor 2. C++ Compiler 8 Aftab Ahmed Palh - Computer Science Instructor
  • 9. Environment Setup Cont… • The files you create with your editor are called source files, and for C++ they typically are named with the extension .cpp • C++ compiler, which will be used to compile your source code into final executable program 9 Aftab Ahmed Palh - Computer Science Instructor
  • 10. Writing C++ Programs • A programmer uses a text editor to create or modify files containing C++ code. • Code is also known as source code. • A file containing source code is called a source file. • After a C++ source file has been created, the programmer must invoke the C++ compiler before the program can be executed (run). 10 Aftab Ahmed Palh - Computer Science Instructor
  • 11. Compiler converts human readable language to a language which is understandable by the operating system/hardware Examples of C/C++ compilers of today: Visual C++ GCC/G++ DJGPP (open source for windows like GCC) Borland C Turbo (obsolete and not recommended) 11 Aftab Ahmed Palh - Computer Science Instructor
  • 12. Program Development Source File Program Object Code File Executable File Preprocessor Modified Source Code in RAM Compiler Linker Other Object Code Files (if any) Editor 12 Aftab Ahmed Palh - Computer Science Instructor
  • 13. A Simple C++ Program #include <iostream.h> //This is preprosessor directive int main ( ) //this tells the starting point of your program { cout << “Hello World” <<endl ; //print the text on monitor return 0 ; //return to operating system } Note: cout is an object given to you by the creators of C++. This function saves you From the complexity of writing your own function of how to display text on the computer Screen. Hence you are more productive with the actual program rather than worrying About such issues. 13 Aftab Ahmed Palh - Computer Science Instructor
  • 14. Elements of C+ Program Preprocessor Directive • Preprocessor Directive tells computer to load contents of a certain file • #include 14 Aftab Ahmed Palh - Computer Science Instructor
  • 15. Elements of C+ Program Header file • Header file contains the implementation code of the c++ functions and c++ keywords. • Iostream.h, conio.h, stdio.h 15 Aftab Ahmed Palh - Computer Science Instructor
  • 16. 16 Elements of C+ Program • int main() – C++ programs contain one or more functions, exactly one of which must be main – Parenthesis used to indicate a function – int means that main "returns" an integer value – Braces { and } indicate a block • The bodies of all functions must be contained in braces – Braces indicate the block of function in c++ program Aftab Ahmed Palh - Computer Science Instructor
  • 17. 17 Elements of C+ Program • return 0; – A way to exit a function – return 0, in this case, means that the program terminated normally • Linker – When a function is called, linker locates it in the library – Inserts it into object program – If function name is misspelled, the linker will produce an error because it will not be able to find function in the library Aftab Ahmed Palh - Computer Science Instructor
  • 18. 18 Elements of C+ Program • Parenthesis () • Parenthesis are used to declare function. Example Int main() • Cout • Cout is a keyword which displays the result of program on monitor screen • Cout<<“hello”; Aftab Ahmed Palh - Computer Science Instructor
  • 19. 19 Elements of C+ Program • Int • Int is a data type of function or variable • Semicolon ; • Semicolon is used to end the program statement. • Program Statement • Program statement or simply statement is the instruction in c++ programming language Aftab Ahmed Palh - Computer Science Instructor