资源描述:
《c语言基础教程课件(英文版)ch》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、AFirstBookofANSICFourthEditionChapter14AdditionalCapabilitiesAFirstBookofANSIC,FourthEdition2ObjectivesAdditionalFeaturesBitOperationsMacrosCommand-LineArgumentsCommonProgrammingandCompilerErrorsAFirstBookofANSIC,FourthEdition3AdditionalFeaturesThetypedefdeclarationstatementConditio
2、nalpreprocessordirectivesEnumeratedconstantsConditionalexpressionsThegotostatementAFirstBookofANSIC,FourthEdition4ThetypedefDeclarationStatementtypedefpermitsconstructingalternatenamesforanexistingCdatatypenametypedefdoubleREAL;makestheREALanaliasfordoubleREALval;isequivalenttodoubl
3、eval;typedefdoesnotcreateanewdatatypeTheequivalenceproducedbytypedefcanfrequentlybeproducedequallywellby#definetypedefprocessedbythecompiler#defineprocessedbythepreprocessorAFirstBookofANSIC,FourthEdition5ThetypedefDeclarationStatement(continued)Anotherexample:typedefintARRAY[100];A
4、RRAYfirst,second;Equivalenttothetwodefinitionsintfirst[100];andintsecond[100];Asanotherexample:typedefstruct{charname[20];intidNum;}empRecord;empRecordemployee[75];AFirstBookofANSIC,FourthEdition6ConditionalPreprocessorDirectives#ifndefand#ifdefpermitconditionalcompilationinthatthes
5、tatementsimmediatelyfollowingthesedirectives,uptoan#elseor#endif,arecompiledonlyiftheconditionistrue,whereasthestatementsfollowingthe#elsearecompiledonlyiftheconditionisfalseForexample,#ifndefconditioncompilethestatementsplacedhere#elsecompilethestatementsplacedhere#endifAFirstBooko
6、fANSIC,FourthEdition7ConditionalPreprocessorDirectives(continued)The#elsedirectiveisoptional#ifndefisthemostfrequentlyusedconditionalpreprocessordirectiveItsmostcommonusageisintheform#ifndefheader-file#include#endifForexample:#ifndefstdio.h#include#endifAFirstB
7、ookofANSIC,FourthEdition8EnumeratedConstantsSetofrelatedintegervaluescanbeequatedtoanequivalentsetofconstantsusinganenumeratedlistenum{Mon,Tue,Wed,Thr,Fri,Sat,Sun};Bydefault,thefirstenumeratednameinanenumeratedlisthasavalueof0Theenumerationaboveisequivalentto:#defineMon0#defineTue1#
8、defineWed2…AFirstBo