SlideShare a Scribd company logo
1 of 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

More Related Content

What's hot

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
 

What's hot (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
 

Similar to 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
 

Similar to 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
 

Recently uploaded

Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...OnePlan Solutions
 
Evolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI EraEvolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI Eraconfluent
 
^Clinic ^%[+27788225528*Abortion Pills For Sale In soweto
^Clinic ^%[+27788225528*Abortion Pills For Sale In soweto^Clinic ^%[+27788225528*Abortion Pills For Sale In soweto
^Clinic ^%[+27788225528*Abortion Pills For Sale In sowetokasambamuno
 
Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Soroosh Khodami
 
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024Andreas Granig
 
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-CloudAlluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-CloudAlluxio, Inc.
 
Sinoville Clinic ](+27832195400*)[🏥Abortion Pill Prices Sinoville ● Women's A...
Sinoville Clinic ](+27832195400*)[🏥Abortion Pill Prices Sinoville ● Women's A...Sinoville Clinic ](+27832195400*)[🏥Abortion Pill Prices Sinoville ● Women's A...
Sinoville Clinic ](+27832195400*)[🏥Abortion Pill Prices Sinoville ● Women's A...Abortion Clinic
 
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024MulesoftMunichMeetup
 
Weeding your micro service landscape.pdf
Weeding your micro service landscape.pdfWeeding your micro service landscape.pdf
Weeding your micro service landscape.pdftimtebeek1
 
architecting-ai-in-the-enterprise-apis-and-applications.pdf
architecting-ai-in-the-enterprise-apis-and-applications.pdfarchitecting-ai-in-the-enterprise-apis-and-applications.pdf
architecting-ai-in-the-enterprise-apis-and-applications.pdfWSO2
 
Spring into AI presented by Dan Vega 5/14
Spring into AI presented by Dan Vega 5/14Spring into AI presented by Dan Vega 5/14
Spring into AI presented by Dan Vega 5/14VMware Tanzu
 
Microsoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdfMicrosoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdfMarkus Moeller
 
How to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabberHow to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabbereGrabber
 
^Clinic ^%[+27788225528*Abortion Pills For Sale In harare
^Clinic ^%[+27788225528*Abortion Pills For Sale In harare^Clinic ^%[+27788225528*Abortion Pills For Sale In harare
^Clinic ^%[+27788225528*Abortion Pills For Sale In hararekasambamuno
 
Lessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdfLessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdfSrushith Repakula
 
What is a Recruitment Management Software?
What is a Recruitment Management Software?What is a Recruitment Management Software?
What is a Recruitment Management Software?NYGGS Automation Suite
 
Effective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeConEffective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeConNatan Silnitsky
 
Transformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with LinksTransformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with LinksJinanKordab
 
From Theory to Practice: Utilizing SpiraPlan's REST API
From Theory to Practice: Utilizing SpiraPlan's REST APIFrom Theory to Practice: Utilizing SpiraPlan's REST API
From Theory to Practice: Utilizing SpiraPlan's REST APIInflectra
 

Recently uploaded (20)

Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
 
Evolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI EraEvolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI Era
 
^Clinic ^%[+27788225528*Abortion Pills For Sale In soweto
^Clinic ^%[+27788225528*Abortion Pills For Sale In soweto^Clinic ^%[+27788225528*Abortion Pills For Sale In soweto
^Clinic ^%[+27788225528*Abortion Pills For Sale In soweto
 
Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024
 
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
 
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-CloudAlluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
 
Sinoville Clinic ](+27832195400*)[🏥Abortion Pill Prices Sinoville ● Women's A...
Sinoville Clinic ](+27832195400*)[🏥Abortion Pill Prices Sinoville ● Women's A...Sinoville Clinic ](+27832195400*)[🏥Abortion Pill Prices Sinoville ● Women's A...
Sinoville Clinic ](+27832195400*)[🏥Abortion Pill Prices Sinoville ● Women's A...
 
Abortion Clinic In Polokwane ](+27832195400*)[ 🏥 Safe Abortion Pills in Polok...
Abortion Clinic In Polokwane ](+27832195400*)[ 🏥 Safe Abortion Pills in Polok...Abortion Clinic In Polokwane ](+27832195400*)[ 🏥 Safe Abortion Pills in Polok...
Abortion Clinic In Polokwane ](+27832195400*)[ 🏥 Safe Abortion Pills in Polok...
 
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
 
Weeding your micro service landscape.pdf
Weeding your micro service landscape.pdfWeeding your micro service landscape.pdf
Weeding your micro service landscape.pdf
 
architecting-ai-in-the-enterprise-apis-and-applications.pdf
architecting-ai-in-the-enterprise-apis-and-applications.pdfarchitecting-ai-in-the-enterprise-apis-and-applications.pdf
architecting-ai-in-the-enterprise-apis-and-applications.pdf
 
Spring into AI presented by Dan Vega 5/14
Spring into AI presented by Dan Vega 5/14Spring into AI presented by Dan Vega 5/14
Spring into AI presented by Dan Vega 5/14
 
Microsoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdfMicrosoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdf
 
How to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabberHow to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabber
 
^Clinic ^%[+27788225528*Abortion Pills For Sale In harare
^Clinic ^%[+27788225528*Abortion Pills For Sale In harare^Clinic ^%[+27788225528*Abortion Pills For Sale In harare
^Clinic ^%[+27788225528*Abortion Pills For Sale In harare
 
Lessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdfLessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdf
 
What is a Recruitment Management Software?
What is a Recruitment Management Software?What is a Recruitment Management Software?
What is a Recruitment Management Software?
 
Effective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeConEffective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeCon
 
Transformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with LinksTransformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with Links
 
From Theory to Practice: Utilizing SpiraPlan's REST API
From Theory to Practice: Utilizing SpiraPlan's REST APIFrom Theory to Practice: Utilizing SpiraPlan's REST API
From Theory to Practice: Utilizing SpiraPlan's REST API
 

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