SlideShare ist ein Scribd-Unternehmen logo
1 von 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]

Weitere ähnliche Inhalte

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Kürzlich hochgeladen

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Kürzlich hochgeladen (20)

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

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.