SlideShare uma empresa Scribd logo
1 de 19
Introduction
Language
email: shujatabbas9@gmail.com
FB/syedshujaatabbaszaidi@fb.com
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
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 both high-level and
low-level language features
3
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
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
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
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
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
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
Program Development
12
Source File
Program Object Code File
Executable File
Preprocessor
Modified Source Code in RAM
Compiler
Linker
Other Object Code Files (if any)
Editor
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
}
13
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.
Elements of C+ Program
Preprocessor Directive
• Preprocessor Directive tells computer to
load contents of a certain file
• #include
14
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
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
16
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
17
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”;
18
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
19

Mais conteúdo relacionado

Mais procurados

Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
Alpana Gupta
 
Brief introduction to the c programming language
Brief introduction to the c programming languageBrief introduction to the c programming language
Brief introduction to the c programming language
Kumar Gaurav
 

Mais procurados (20)

Introduction to C Language
Introduction to C LanguageIntroduction to C Language
Introduction to C Language
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
 
Introduction of c programming
Introduction of c programmingIntroduction of c programming
Introduction of c programming
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
COM1407: Introduction to C Programming
COM1407: Introduction to C Programming COM1407: Introduction to C Programming
COM1407: Introduction to C Programming
 
introduction to c programming language
introduction to c programming languageintroduction to c programming language
introduction to c programming language
 
C programming basics
C  programming basicsC  programming basics
C programming basics
 
C PROGRAMMING
C PROGRAMMINGC PROGRAMMING
C PROGRAMMING
 
C programming slide day 01 uploadd by md abdullah al shakil
C programming slide day 01 uploadd by md abdullah al shakilC programming slide day 01 uploadd by md abdullah al shakil
C programming slide day 01 uploadd by md abdullah al shakil
 
introduction to C programming (C)
introduction to C programming (C)introduction to C programming (C)
introduction to C programming (C)
 
Programming in c
Programming in cProgramming in c
Programming in c
 
Programming Fundamental Presentation
Programming Fundamental PresentationProgramming Fundamental Presentation
Programming Fundamental Presentation
 
C languaGE UNIT-1
C languaGE UNIT-1C languaGE UNIT-1
C languaGE UNIT-1
 
C Language
C LanguageC Language
C Language
 
C programming
C programmingC programming
C programming
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Brief introduction to the c programming language
Brief introduction to the c programming languageBrief introduction to the c programming language
Brief introduction to the c programming language
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
 
C_Programming_Notes_ICE
C_Programming_Notes_ICEC_Programming_Notes_ICE
C_Programming_Notes_ICE
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 

Destaque (9)

Decision making systems
Decision making systemsDecision making systems
Decision making systems
 
Introduccion a Lenguaje HTML, Programacion Web
Introduccion a Lenguaje HTML, Programacion WebIntroduccion a Lenguaje HTML, Programacion Web
Introduccion a Lenguaje HTML, Programacion Web
 
Front page part-Customer Satisfaction analysis on BUBT
Front page part-Customer Satisfaction analysis on BUBTFront page part-Customer Satisfaction analysis on BUBT
Front page part-Customer Satisfaction analysis on BUBT
 
Agricultural value chain analysis
Agricultural value chain analysisAgricultural value chain analysis
Agricultural value chain analysis
 
Introduction to macroeconomics
Introduction to macroeconomicsIntroduction to macroeconomics
Introduction to macroeconomics
 
Home automation using android mobiles
Home automation using android mobilesHome automation using android mobiles
Home automation using android mobiles
 
Atención
AtenciónAtención
Atención
 
Campaign Analysis for Logan
Campaign Analysis for LoganCampaign Analysis for Logan
Campaign Analysis for Logan
 
THE WOLVERINE logan
THE WOLVERINE    loganTHE WOLVERINE    logan
THE WOLVERINE logan
 

Semelhante a Introduction to C Language (By: Shujaat Abbas)

Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJIntroduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
meharikiros2
 

Semelhante a Introduction to C Language (By: Shujaat Abbas) (20)

Introduction to C Language
Introduction to C LanguageIntroduction to C Language
Introduction to C Language
 
Csc240 -lecture_3
Csc240  -lecture_3Csc240  -lecture_3
Csc240 -lecture_3
 
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
 
Session 1 - c++ intro
Session   1 - c++ introSession   1 - c++ intro
Session 1 - c++ intro
 
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
 
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 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).doc
 
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...
 
C++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.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
 
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++
 
C language unit-1
C language unit-1C language unit-1
C language unit-1
 
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDYC LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
 
Whole c++ lectures ITM1 Th
Whole c++ lectures ITM1 ThWhole c++ lectures ITM1 Th
Whole c++ lectures ITM1 Th
 
Learn C Language
Learn C LanguageLearn C Language
Learn C Language
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdf
 
C Programming UNIT 1.pptx
C Programming  UNIT 1.pptxC Programming  UNIT 1.pptx
C Programming UNIT 1.pptx
 
C_Intro.ppt
C_Intro.pptC_Intro.ppt
C_Intro.ppt
 
Unit ii
Unit   iiUnit   ii
Unit ii
 

Último

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
VictorSzoltysek
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
+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
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Último (20)

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
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 ...
 
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
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
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 🔝✔️✔️
 
+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...
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
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
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
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
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
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
 

Introduction to C Language (By: Shujaat Abbas)

  • 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
  • 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 both high-level and low-level language features 3
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 12. Program Development 12 Source File Program Object Code File Executable File Preprocessor Modified Source Code in RAM Compiler Linker Other Object Code Files (if any) Editor
  • 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 } 13 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.
  • 14. Elements of C+ Program Preprocessor Directive • Preprocessor Directive tells computer to load contents of a certain file • #include 14
  • 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
  • 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 16
  • 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 17
  • 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”; 18
  • 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 19