SlideShare uma empresa Scribd logo
1 de 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]

Mais conteúdo relacionado

Mais procurados (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
 

Destaque

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
 

Destaque (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
 

Semelhante a 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
 

Semelhante a 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
 

Mais de 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
 

Último

Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 

Último (20)

Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

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.