欢迎来到天天文库
浏览记录
ID:34104546
大小:413.78 KB
页数:26页
时间:2019-03-03
《c-2 introduction》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、FundamentalsofProgramming(C)MingtaoPeiSchoolofComputerSciencepeimt@bit.edu.cnLecture2IntroductionOutline2.1OverviewofC2.2BasicStructureofCProgram2.3EssentialElementsofC2.4ProgrammingProcess3Outline2.1OverviewofC2.2BasicStructureofCProgram2.3EssentialElementsofC2.4ProgrammingPro
2、cess4TheHistoryofC1967Martin.RichadsofCambridge:CPL→BCPL1970Ken·ThompsonofBellLaboratories:BCPL→B1972Dennis·RitchieofBellLaboratories:B→C1973K.Thompson&D.Ritchie:RewriteUNIXbyC1977UNIX&Carewidelyused5TheHistoryofC1978Thefamousbook《TheCProgrammingLanguage》ispublishedBythe
3、early1980s,CevolvedintoTraditionalCInthelate1980s,ANSIcreateddraftstandardsforANSICorstandardCIn1990,ISOacceptedANSICasISOstandardC6WhyC?Cisportable.CodewrittenononemachinecanbeeasilymovedtoanotherCisterseCismodularCisthebasisofC++andjavaCisefficientonmostmachines.Criti
4、cismofCComplicatedsyntaxNoautomaticarrayboundschecking7Outline2.1OverviewofC2.2BasicStructureofCProgram2.3EssentialElementsofC2.4ProgrammingProcess8ExampleCprogram9AnotherExample10BasicStructureofCProgram11BasicStructureofCProgramCprogramconsistsofoneofmorefunctionsThereiso
5、neandonlyonemainfunction“main()”ProgramexecutionalwaysstartswiththemainfunctionFunctionconsistsoftwoparts:headerandbodyHeaderincludesthename,typeandparametersofthefunctionBodyincludesthedefinitionofvariablesandstatements12BasicStructureofCProgramStatementsconsistofbasiccha
6、ractersandlexicalelementsaccordingtotheCsyntaxrules,endedbyasemicolon“;”OnecanwriteoneormorestatementsinonelineLower-caselettersareusuallyusedinStatementsCommentsarearbitrarystringsofsymbolsplacedbetweenthedelimiters/*and*/orbeginwith//andruntotheendoftheline13BasicStructure
7、ofCProgramConstantsStatement1Main()VariablesCStatement2……OperatorsProgram……Function_nExpressionsStatement_n……14Outline2.1OverviewofC2.2BasicStructureofCProgram2.3EssentialElementsofC2.4ProgrammingProcess15CharactersandLexicalElementsNumbers:0123456789Letters:abc……zABC……ZOper
8、ators:+-*/%=<><=>=!===<<>>&
9、∧~&&
10、
11、!()[]{}->.?:,;Spe
此文档下载收益归作者所有