SlideShare a Scribd company logo
1 of 27
C Programming Course Overview ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Why teach C? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Some programmer jargon ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
More about Hello World Preprocessor Library command main() means “start here” Comments are good Return 0 from main means our program finished without errors Brackets define code blocks
C doesn’t care much about spaces Both of these programs are exactly the same as the original as far as your compiler is concerned. Note that words have to be kept together and so do things in quotes. In the next lecture we'll learn how we SHOULD lay out our C program to make them look nice
 
Keywords of C ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Types of variable ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Naming variables ,[object Object],[object Object],[object Object],[object Object],int a,b; double d; /* This is a bit cryptic */ int start_time; int no_students; double course_mark; /* This is a bit better */
The  char  type ,[object Object],[object Object],[object Object],[object Object],int main() { char a, b; a= 'x';  /* Set a to the character x */ printf ("a is %c",a); b= ''; /* This really is one character*/ printf ("b is %c",b); return 0; }
More types: Signed/unsigned, long, short, const ,[object Object],[object Object],[object Object],short int small_no;  unsigned char uchar; long double precise_number; short float not_so_precise; const short float pi= 3.14; const long double e= 2.718281828;
A short note about  ++ ,[object Object],[object Object],int i= 6; printf ("%d",i++);  /* Prints 6 sets i to 7 */ int i= 6; printf ("%d",++i);  /* prints 7 and sets i to 7 */ Note this important difference It is easy to confuse yourself and others with the difference  between  ++i  and  i++  - it is best to use them only in simple ways. All of the above also applies to  -- .
Some simple operations for variables ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Casting between variables ,[object Object],[object Object],int a= 3; int b= 4; double c; c= (double)a/(double)b; By using  ( type )  in front of a variable we tell the variable to act like another type of variable.  We can cast between any type.  Usually, however, the only reason to cast is to stop ints being rounded by division. Cast ints a and b to be doubles
What is a function? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
An example function Prototype the function Call the function The function itself function header
Functions can access other functions ,[object Object]
void  functions ,[object Object],Prototype (at top of file remember) void odd_or_even (int); Function takes and returns void (no arguments) Function which takes one int arguments and returns none Another prototype
Notes about functions ,[object Object],[object Object],[object Object],[object Object]
Where do functions go in the program ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What are these prototype things? ,[object Object],[object Object],[object Object],[object Object]
What is scope? ,[object Object],[object Object],[object Object],[object Object],[object Object]
The print stars example This program prints five rows of five stars This prints 'n' stars and then a new line character Loop around 5 times to  print the stars ***** ***** ***** ***** ***** Variables here are LOCAL variables
Why global is bad This program only prints ONE row of five stars Variable here is global variable
Thinking like the computer for debugging  ,[object Object],[object Object],[object Object],[object Object]
Factorial program (and thoughts) int main() { int number= 4; int answer; int count; answer= 1; count= number; while (count >= 0) { answer= answer* count; count--; } printf ("%d! = %d", number,answer); return 0; } number= 4 answer= 1 count= 4 enter while loop answer= 1*4=4 count=3 enter while loop answer=4*3= 12 count=2 enter while loop answer=12*2= 24 count= 1 enter while loop answer= 24*1= 24 count= 0 enter while loop answer= 24*0= 0 AHA – I see!!!
Other techniques for debugging ,[object Object],[object Object],[object Object],[object Object],[object Object]

More Related Content

What's hot (20)

What is c
What is cWhat is c
What is c
 
Lecture 9- Control Structures 1
Lecture 9- Control Structures 1Lecture 9- Control Structures 1
Lecture 9- Control Structures 1
 
Lecture 11 - Functions
Lecture 11 - FunctionsLecture 11 - Functions
Lecture 11 - Functions
 
7 functions
7  functions7  functions
7 functions
 
Lecture 10 - Control Structures 2
Lecture 10 - Control Structures 2Lecture 10 - Control Structures 2
Lecture 10 - Control Structures 2
 
C Programming Tutorial - www.infomtec.com
C Programming Tutorial - www.infomtec.comC Programming Tutorial - www.infomtec.com
C Programming Tutorial - www.infomtec.com
 
Void pointer in c
Void pointer in cVoid pointer in c
Void pointer in c
 
4 operators, expressions & statements
4  operators, expressions & statements4  operators, expressions & statements
4 operators, expressions & statements
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
Input And Output
 Input And Output Input And Output
Input And Output
 
Assignment12
Assignment12Assignment12
Assignment12
 
Operators and Control Statements in Python
Operators and Control Statements in PythonOperators and Control Statements in Python
Operators and Control Statements in Python
 
Concepts of C [Module 2]
Concepts of C [Module 2]Concepts of C [Module 2]
Concepts of C [Module 2]
 
Python-02| Input, Output & Import
Python-02| Input, Output & ImportPython-02| Input, Output & Import
Python-02| Input, Output & Import
 
Python Unit 3 - Control Flow and Functions
Python Unit 3 - Control Flow and FunctionsPython Unit 3 - Control Flow and Functions
Python Unit 3 - Control Flow and Functions
 
Unit ii ppt
Unit ii pptUnit ii ppt
Unit ii ppt
 
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’
 
C language basics
C language basicsC language basics
C language basics
 
CPU INPUT OUTPUT
CPU INPUT OUTPUT CPU INPUT OUTPUT
CPU INPUT OUTPUT
 

Viewers also liked

what professional job is like
what professional job is likewhat professional job is like
what professional job is likejefferyshiau
 
REAP WHAT YOU SOW
REAP WHAT YOU SOWREAP WHAT YOU SOW
REAP WHAT YOU SOWdebzters
 
omgaan met auteursrecht in het moderne onderwijs train-de-trainer iScholengroep
omgaan met auteursrecht in het moderne onderwijs train-de-trainer iScholengroepomgaan met auteursrecht in het moderne onderwijs train-de-trainer iScholengroep
omgaan met auteursrecht in het moderne onderwijs train-de-trainer iScholengroepKennisland
 
Co quan cam giac p1 (anh)
Co quan cam giac p1 (anh)Co quan cam giac p1 (anh)
Co quan cam giac p1 (anh)Pham Ngoc Quang
 
Chuong 6 stress thich nghi
Chuong 6 stress   thich nghiChuong 6 stress   thich nghi
Chuong 6 stress thich nghiPham Ngoc Quang
 
Safari 2011 team abc onderwijsadviseurs
Safari 2011   team abc onderwijsadviseursSafari 2011   team abc onderwijsadviseurs
Safari 2011 team abc onderwijsadviseursKennisland
 
Baraka blues aesthetic
Baraka blues aestheticBaraka blues aesthetic
Baraka blues aestheticTeresa Levy
 
AP US Museum Presentation 1960s
AP US Museum Presentation 1960sAP US Museum Presentation 1960s
AP US Museum Presentation 1960scrazy4football3
 
TANET - Luat thue TNDN - 07.2010
TANET - Luat thue TNDN -  07.2010TANET - Luat thue TNDN -  07.2010
TANET - Luat thue TNDN - 07.2010Pham Ngoc Quang
 
Bet youdon'tknowreading
Bet youdon'tknowreadingBet youdon'tknowreading
Bet youdon'tknowreadingMonica Campana
 
Ocd masterclass 2014_terugkomdag_impactmeting
Ocd masterclass 2014_terugkomdag_impactmetingOcd masterclass 2014_terugkomdag_impactmeting
Ocd masterclass 2014_terugkomdag_impactmetingKennisland
 
Anarcho multiculturalism and_education (1)
Anarcho multiculturalism and_education (1)Anarcho multiculturalism and_education (1)
Anarcho multiculturalism and_education (1)Teresa Levy
 
Summit keynote Anna Maybank
Summit keynote Anna MaybankSummit keynote Anna Maybank
Summit keynote Anna MaybankKennisland
 
Tackling the Talent Challenge
Tackling the Talent ChallengeTackling the Talent Challenge
Tackling the Talent ChallengeDavid Fletcher
 
Business continuity for Information Systems
Business continuity for Information SystemsBusiness continuity for Information Systems
Business continuity for Information SystemsDavid Fletcher
 

Viewers also liked (20)

what professional job is like
what professional job is likewhat professional job is like
what professional job is like
 
REAP WHAT YOU SOW
REAP WHAT YOU SOWREAP WHAT YOU SOW
REAP WHAT YOU SOW
 
omgaan met auteursrecht in het moderne onderwijs train-de-trainer iScholengroep
omgaan met auteursrecht in het moderne onderwijs train-de-trainer iScholengroepomgaan met auteursrecht in het moderne onderwijs train-de-trainer iScholengroep
omgaan met auteursrecht in het moderne onderwijs train-de-trainer iScholengroep
 
Pavlov
PavlovPavlov
Pavlov
 
Nhap mon sinh hoc 1
Nhap mon sinh hoc 1Nhap mon sinh hoc 1
Nhap mon sinh hoc 1
 
Co quan cam giac p1 (anh)
Co quan cam giac p1 (anh)Co quan cam giac p1 (anh)
Co quan cam giac p1 (anh)
 
Chuong 6 stress thich nghi
Chuong 6 stress   thich nghiChuong 6 stress   thich nghi
Chuong 6 stress thich nghi
 
Safari 2011 team abc onderwijsadviseurs
Safari 2011   team abc onderwijsadviseursSafari 2011   team abc onderwijsadviseurs
Safari 2011 team abc onderwijsadviseurs
 
Baraka blues aesthetic
Baraka blues aestheticBaraka blues aesthetic
Baraka blues aesthetic
 
AP US Museum Presentation 1960s
AP US Museum Presentation 1960sAP US Museum Presentation 1960s
AP US Museum Presentation 1960s
 
TANET - Luat thue TNDN - 07.2010
TANET - Luat thue TNDN -  07.2010TANET - Luat thue TNDN -  07.2010
TANET - Luat thue TNDN - 07.2010
 
Bet youdon'tknowreading
Bet youdon'tknowreadingBet youdon'tknowreading
Bet youdon'tknowreading
 
Ocd masterclass 2014_terugkomdag_impactmeting
Ocd masterclass 2014_terugkomdag_impactmetingOcd masterclass 2014_terugkomdag_impactmeting
Ocd masterclass 2014_terugkomdag_impactmeting
 
Case Sara Zoekt Werk
Case Sara Zoekt WerkCase Sara Zoekt Werk
Case Sara Zoekt Werk
 
Specimenprep
SpecimenprepSpecimenprep
Specimenprep
 
Anarcho multiculturalism and_education (1)
Anarcho multiculturalism and_education (1)Anarcho multiculturalism and_education (1)
Anarcho multiculturalism and_education (1)
 
Summit keynote Anna Maybank
Summit keynote Anna MaybankSummit keynote Anna Maybank
Summit keynote Anna Maybank
 
Tackling the Talent Challenge
Tackling the Talent ChallengeTackling the Talent Challenge
Tackling the Talent Challenge
 
jaredppt
jaredpptjaredppt
jaredppt
 
Business continuity for Information Systems
Business continuity for Information SystemsBusiness continuity for Information Systems
Business continuity for Information Systems
 

Similar to Lập trình C

Presentation 2 (1).pdf
Presentation 2 (1).pdfPresentation 2 (1).pdf
Presentation 2 (1).pdfziyadaslanbey
 
C programing Tutorial
C programing TutorialC programing Tutorial
C programing TutorialMahira Banu
 
Tutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng verTutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng verQrembiezs Intruder
 
INDIAN INSTITUTE OF TECHNOLOGY OF KANPURESC 111M Lec03.pptx
INDIAN INSTITUTE OF TECHNOLOGY OF KANPURESC 111M Lec03.pptxINDIAN INSTITUTE OF TECHNOLOGY OF KANPURESC 111M Lec03.pptx
INDIAN INSTITUTE OF TECHNOLOGY OF KANPURESC 111M Lec03.pptxAbhimanyuChaure
 
Claguage 110226222227-phpapp02
Claguage 110226222227-phpapp02Claguage 110226222227-phpapp02
Claguage 110226222227-phpapp02CIMAP
 
The Sieve of Eratosthenes - Part 1
The Sieve of Eratosthenes - Part 1The Sieve of Eratosthenes - Part 1
The Sieve of Eratosthenes - Part 1Philip Schwarz
 
The Sieve of Eratosthenes - Part 1 - with minor corrections
The Sieve of Eratosthenes - Part 1 - with minor correctionsThe Sieve of Eratosthenes - Part 1 - with minor corrections
The Sieve of Eratosthenes - Part 1 - with minor correctionsPhilip Schwarz
 
Presentation 5th
Presentation 5thPresentation 5th
Presentation 5thConnex
 
Python breakdown-workbook
Python breakdown-workbookPython breakdown-workbook
Python breakdown-workbookHARUN PEHLIVAN
 
88 c programs 15184
88 c programs 1518488 c programs 15184
88 c programs 15184Sumit Saini
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance levelsajjad ali khan
 
C programming_MSBTE_Diploma_Pranoti Doke
C programming_MSBTE_Diploma_Pranoti DokeC programming_MSBTE_Diploma_Pranoti Doke
C programming_MSBTE_Diploma_Pranoti DokePranoti Doke
 
the refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptxthe refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptxAnkitaVerma776806
 

Similar to Lập trình C (20)

C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
C++ lecture 01
C++   lecture 01C++   lecture 01
C++ lecture 01
 
Presentation 2 (1).pdf
Presentation 2 (1).pdfPresentation 2 (1).pdf
Presentation 2 (1).pdf
 
C programing Tutorial
C programing TutorialC programing Tutorial
C programing Tutorial
 
Tutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng verTutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng ver
 
INDIAN INSTITUTE OF TECHNOLOGY OF KANPURESC 111M Lec03.pptx
INDIAN INSTITUTE OF TECHNOLOGY OF KANPURESC 111M Lec03.pptxINDIAN INSTITUTE OF TECHNOLOGY OF KANPURESC 111M Lec03.pptx
INDIAN INSTITUTE OF TECHNOLOGY OF KANPURESC 111M Lec03.pptx
 
#Code2 create c++ for beginners
#Code2 create  c++ for beginners #Code2 create  c++ for beginners
#Code2 create c++ for beginners
 
Claguage 110226222227-phpapp02
Claguage 110226222227-phpapp02Claguage 110226222227-phpapp02
Claguage 110226222227-phpapp02
 
Learn C
Learn CLearn C
Learn C
 
The Sieve of Eratosthenes - Part 1
The Sieve of Eratosthenes - Part 1The Sieve of Eratosthenes - Part 1
The Sieve of Eratosthenes - Part 1
 
The Sieve of Eratosthenes - Part 1 - with minor corrections
The Sieve of Eratosthenes - Part 1 - with minor correctionsThe Sieve of Eratosthenes - Part 1 - with minor corrections
The Sieve of Eratosthenes - Part 1 - with minor corrections
 
Presentation 5th
Presentation 5thPresentation 5th
Presentation 5th
 
Python breakdown-workbook
Python breakdown-workbookPython breakdown-workbook
Python breakdown-workbook
 
88 c programs 15184
88 c programs 1518488 c programs 15184
88 c programs 15184
 
88 c-programs
88 c-programs88 c-programs
88 c-programs
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance level
 
C programming
C programmingC programming
C programming
 
C programming_MSBTE_Diploma_Pranoti Doke
C programming_MSBTE_Diploma_Pranoti DokeC programming_MSBTE_Diploma_Pranoti Doke
C programming_MSBTE_Diploma_Pranoti Doke
 
88 c-programs
88 c-programs88 c-programs
88 c-programs
 
the refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptxthe refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptx
 

More from Viet NguyenHoang (20)

Thai nguyen 02-midrex
Thai nguyen 02-midrexThai nguyen 02-midrex
Thai nguyen 02-midrex
 
Thai nguyen 04-corex
Thai nguyen 04-corexThai nguyen 04-corex
Thai nguyen 04-corex
 
Thai nguyen 03-1-slrn
Thai nguyen 03-1-slrnThai nguyen 03-1-slrn
Thai nguyen 03-1-slrn
 
Thai nguyen 01-intro-print
Thai nguyen 01-intro-printThai nguyen 01-intro-print
Thai nguyen 01-intro-print
 
Lost foam cast process
Lost foam cast processLost foam cast process
Lost foam cast process
 
Grain size analysis by using ImageJ
Grain size analysis by using ImageJGrain size analysis by using ImageJ
Grain size analysis by using ImageJ
 
Tem Samp1
Tem Samp1Tem Samp1
Tem Samp1
 
Tem2
Tem2Tem2
Tem2
 
Tem1
Tem1Tem1
Tem1
 
Sin2005
Sin2005Sin2005
Sin2005
 
Nano Indentation Lecture1
Nano Indentation Lecture1Nano Indentation Lecture1
Nano Indentation Lecture1
 
Nano Indentation Lecture2
Nano Indentation Lecture2Nano Indentation Lecture2
Nano Indentation Lecture2
 
Thép
ThépThép
Thép
 
Govnet.Ppt
Govnet.PptGovnet.Ppt
Govnet.Ppt
 
Licensing,Ppt
Licensing,PptLicensing,Ppt
Licensing,Ppt
 
Open Source Presentation To Portal Partners2
Open Source Presentation To Portal Partners2Open Source Presentation To Portal Partners2
Open Source Presentation To Portal Partners2
 
Opensource Powerpoint Review.Ppt
Opensource Powerpoint Review.PptOpensource Powerpoint Review.Ppt
Opensource Powerpoint Review.Ppt
 
Manufacturing
ManufacturingManufacturing
Manufacturing
 
Nuclear Power
Nuclear PowerNuclear Power
Nuclear Power
 
Thermal Energy
Thermal EnergyThermal Energy
Thermal Energy
 

Recently uploaded

Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 

Recently uploaded (20)

Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 

Lập trình C

  • 1.
  • 2.
  • 3.
  • 4. More about Hello World Preprocessor Library command main() means “start here” Comments are good Return 0 from main means our program finished without errors Brackets define code blocks
  • 5. C doesn’t care much about spaces Both of these programs are exactly the same as the original as far as your compiler is concerned. Note that words have to be kept together and so do things in quotes. In the next lecture we'll learn how we SHOULD lay out our C program to make them look nice
  • 6.  
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16. An example function Prototype the function Call the function The function itself function header
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23. The print stars example This program prints five rows of five stars This prints 'n' stars and then a new line character Loop around 5 times to print the stars ***** ***** ***** ***** ***** Variables here are LOCAL variables
  • 24. Why global is bad This program only prints ONE row of five stars Variable here is global variable
  • 25.
  • 26. Factorial program (and thoughts) int main() { int number= 4; int answer; int count; answer= 1; count= number; while (count >= 0) { answer= answer* count; count--; } printf ("%d! = %d", number,answer); return 0; } number= 4 answer= 1 count= 4 enter while loop answer= 1*4=4 count=3 enter while loop answer=4*3= 12 count=2 enter while loop answer=12*2= 24 count= 1 enter while loop answer= 24*1= 24 count= 0 enter while loop answer= 24*0= 0 AHA – I see!!!
  • 27.