INCITS/ISO/IEC9899-2011|2012](ISO/IEC9899-2011,IDT)sInformation technology Programminglanguages-CDeveloped byincitsWhereITallbeginsted American NationANSI
INCITS/ISO/IEC 9899-2011[2012] (ISO/IEC 9899-2011, IDT) Information technology — Programming languages — C
INCITS/ISO/IEC9899-2011[2012]PDFdisclaimerThisPDFfilemaycontainembeddedtypefaces.InaccordancewithAdobe'slicensingpolicy,thisflemaybeprinted orviewed but shall notbeeditedunlessthetypefaces whichareembeddedare licensedtoand installed onthecomputerperformingthe editing.Indownloadingthisfile,parties accept therein the responsibility of not infringing Adobe's licensing policy.The ISO Central Secretariat accepts no liability in thisarea.Adobe is a trademark of Adobe Systems Incorporated.Details of the software products used to create this PDF fle can be found in the General Info relative to the file; the PDF-creation parameterswere optimized for printing.Every care has been taken to ensure that the file is suitablefor use by ISOmember bodies. In the unlikely eventthat a problem relating to it is found, please inform the Central Secretariat at the address given below.AdoptedbyINCiTS(lnterNationalCommitteeforInformationTechnologyStandards)asanAmericanNationalStandard.DateofANSIApproval:5/23/2012Published by American National Standards Institute,25West43rdStreet,NewYork,NewYork10036Copyright 2012by InformationTechnology Industry Council(ITI). All rights reservedThese materials are subject to copyright claims of International Standardization Organization (ISO),IntermationalElectrotechnical Commission (IEC),AmericanNational Standards Institute(ANSI),andInformation TechnologyIndustry Council (ITl).Notforresale.Nopartof thispublicationmaybereproduced inanyform, including anelectronic retrieval system,without the prior written permission of iTI.All requests pertaining to this standardshouldbesubmittedtoITI,1250EyeStreetNW,Washington,DC20005PrintedintheUnitedStatesofAmericaiITIC2012-Allrightsreserved
INCITS/ISO/IEC 9899-2011[2012] PDF disclaimer This PDF file may contain embedded typefaces. In accordance with Adobe's licensing policy, this file may be printed or viewed but shall not be edited unless the typefaces which are embedded are licensed to and installed on the computer performing the editing. In downloading this file, parties accept therein the responsibility of not infringing Adobe's licensing policy. The ISO Central Secretariat accepts no liability in this area. Adobe is a trademark of Adobe Systems Incorporated. Details of the software products used to create this PDF file can be found in the General Info relative to the file; the PDF-creation parameters were optimized for printing. Every care has been taken to ensure that the file is suitable for use by ISO member bodies. In the unlikely event that a problem relating to it is found, please inform the Central Secretariat at the address given below. Adopted by INCITS (InterNational Committee for Information Technology Standards) as an American National Standard. Date of ANSI Approval: 5/23/2012 Published by American National Standards Institute, 25 West 43rd Street, New York, New York 10036 Copyright 2012 by Information Technology Industry Council (ITI). All rights reserved. These materials are subject to copyright claims of International Standardization Organization (ISO), International Electrotechnical Commission (IEC), American National Standards Institute (ANSI), and Information Technology Industry Council (ITI). Not for resale. No part of this publication may be reproduced in any form, including an electronic retrieval system, without the prior written permission of ITI. All requests pertaining to this standard should be submitted to ITI, 1250 Eye Street NW, Washington, DC 20005. Printed in the United States of America ii © ITIC 2012 – All rights reserved
ISO/IEC 2011 - All rights reservedISO/IEC9899:2011 (E)ContentsForewordxiliIntroductionxvi11.Scope22.Normative references33. Terms, definitions, and symbols84.Conformance105.Environment105.1Conceptual models105.1.1Translation environment125.1.2Execution environments225.2Environmental considerations225.2.1Character sets245.2.2Character display semantics255.2.3Signals and interrupts255.2.4Environmental limits356.Language356.1Notation356.2Concepts356.2.1Scopes of identifiers366.2.2Linkages of identifiers376.2.3Namespaces ofidentifiers386.2.4Storage durations of objects396.2.5Types6.2.644Representations of types476.2.7Compatibletypeand compositetype6.2.848Alignment of objects6.350Conversions506.3.1Arithmetic operands546.3.2Otheroperands576.4Lexical elements586.4.1Keywords6.4.259Identifiers6.4.361Universal characternames626.4.4Constants706.4.5String literals726.4.6Punctuators736.4.7Headernames746.4.8Preprocessing numbers756.4.9CommentsiliContents
© ISO/IEC 2011 − All rights reserved ISO/IEC 9899:2011 (E) Contents Foreword . xiii Introduction . xvii 1. Scope . 1 2. Normative references . 2 3. Terms, definitions, and symbols . 3 4. Conformance . 8 5. Environment . 10 5.1 Conceptual models . 10 5.1.1 Translation environment . 10 5.1.2 Execution environments . 12 5.2 Environmental considerations . 22 5.2.1 Character sets . 22 5.2.2 Character display semantics . 24 5.2.3 Signals and interrupts . 25 5.2.4 Environmental limits . 25 6. Language . 35 6.1 Notation . 35 6.2 Concepts . 35 6.2.1 Scopes of identifiers . 35 6.2.2 Linkages of identifiers . 36 6.2.3 Name spaces of identifiers . 37 6.2.4 Storage durations of objects . 38 6.2.5 Types . 39 6.2.6 Representations of types . 44 6.2.7 Compatible type and composite type . 47 6.2.8 Alignment of objects . 48 6.3 Conversions . 50 6.3.1 Arithmetic operands . 50 6.3.2 Other operands . 54 6.4 Lexical elements . 57 6.4.1 Keywords . 58 6.4.2 Identifiers . 59 6.4.3 Universal character names . 61 6.4.4 Constants . 62 6.4.5 String literals . 70 6.4.6 Punctuators . 72 6.4.7 Header names . 73 6.4.8 Preprocessing numbers . 74 6.4.9 Comments . 75 Contents iii
ISO/IEC9899:2011 (E)ISO/IEC 2011 - All rights reserved6.576Expressions6.5.178Primary expressions796.5.2Postfix operators6.5.388Unaryoperators916.5.4Cast operators926.5.5Multiplicativeoperators926.5.6Additive operators946.5.7Bitwise shift operators956.5.8Relational operators966.5.9Equalityoperators976.5.10Bitwise AND operator986.5.11Bitwise exclusive OR operator986.5.12Bitwise inclusive OR operator996.5.13Logical AND operator996.5.14Logical OR operator6.5.15100Conditional operator6.5.16101Assignment operators1056.5.17Comma operator6.6106Constant expressions6.7108Declarations1096.7.1Storage-class specifiers6.7.2111Type specifiers6.7.3121Typequalifiers6.7.4125Function specifiers6.7.5127Alignment specifier6.7.6128Declarators6.7.7136Typenames6.7.8137Type definitions6.7.9139Initialization1456.7.10Static assertions6.8Statements and blocks1466.8.1146Labeled statements6.8.2147Compound statement6.8.3147Expression and null statements6.8.4148Selection statements6.8.5150Iteration statements6.8.6151Jumpstatements6.9155External definitions1566.9.1Function definitions6.9.2158Externalobjectdefinitions1606.10 Preprocessingdirectives1626.10.1Conditional inclusion1646.10.2Source file inclusion1666.10.3Macro replacementivContents
ISO/IEC 9899:2011 (E) © ISO/IEC 2011 − All rights reserved 6.5 Expressions . 76 6.5.1 Primary expressions . 78 6.5.2 Postfix operators . 79 6.5.3 Unary operators . 88 6.5.4 Cast operators . 91 6.5.5 Multiplicative operators . 92 6.5.6 Additive operators . 92 6.5.7 Bitwise shift operators . 94 6.5.8 Relational operators . 95 6.5.9 Equality operators . 96 6.5.10 Bitwise AND operator . 97 6.5.11 Bitwise exclusive OR operator . 98 6.5.12 Bitwise inclusive OR operator . 98 6.5.13 Logical AND operator . 99 6.5.14 Logical OR operator . 99 6.5.15 Conditional operator . 100 6.5.16 Assignment operators . 101 6.5.17 Comma operator . 105 6.6 Constant expressions . 106 6.7 Declarations . 108 6.7.1 Storage-class specifiers . 109 6.7.2 Type specifiers . 111 6.7.3 Type qualifiers . 121 6.7.4 Function specifiers . 125 6.7.5 Alignment specifier . 127 6.7.6 Declarators . 128 6.7.7 Type names . 136 6.7.8 Type definitions . 137 6.7.9 Initialization . 139 6.7.10 Static assertions . 145 6.8 Statements and blocks . 146 6.8.1 Labeled statements . 146 6.8.2 Compound statement . 147 6.8.3 Expression and null statements . 147 6.8.4 Selection statements . 148 6.8.5 Iteration statements . 150 6.8.6 Jump statements . 151 6.9 External definitions . 155 6.9.1 Function definitions . 156 6.9.2 External object definitions . 158 6.10 Preprocessing directives . 160 6.10.1 Conditional inclusion . 162 6.10.2 Source file inclusion . 164 6.10.3 Macro replacement . 166 iv Contents
ISO/IEC 2011 - All rights reservedISO/IEC9899:2011(E)1736.10.4Line control1746.10.5Error directive1746.10.6Pragma directive1756.10.7Null directive1756.10.8Predefinedmacronames1786.10.9Pragma operator1796.11 Future language directions1796.11.1Floatingtypes1796.11.2Linkages of identifiers1796.11.3External names1796.11.4Characterescapesequences1796.11.5Storage-class specifiers1796.11.6Function declarators1796.11.7Function definitions1796.11.8Pragma directives.·1796.11.9Predefined macro names.1807. Library1807.1Introduction1807.1.1Definitions of terms7.1.2181Standard headers7.1.3182Reserved identifiers7.1.4183Use of library functions1867.2Diagnostics<assert.h>7.2.1186Program diagnostics1887.3Complex arithmetic<complex.h>7.3.1188Introduction7.3.2189Conventions1897.3.3Branch cuts7.3.4189TheCXLIMITED_RANGEpragma7.3.5190Trigonometric functions1927.3.6Hyperbolic functions1947.3.7Exponential and logarithmicfunctions1957.3.8Power andabsolute-valuefunctions7.3.9196Manipulationfunctions7.4200Character handling<ctype.h>2007.4.1Character classification functions7.4.2203Character case mappingfunctions7.5205Errors<errno.h>2067.6Floating-point environment<fenv.h>2087.6.1The FENV ACCESS pragma2097.6.2Floating-point exceptions2127.6.3Rounding7.6.4213Environment2167.7Characteristics of floating types <float.h>Contentsv
© ISO/IEC 2011 − All rights reserved ISO/IEC 9899:2011 (E) 6.10.4 Line control . 173 6.10.5 Error directive . 174 6.10.6 Pragma directive . 174 6.10.7 Null directive . 175 6.10.8 Predefined macro names . 175 6.10.9 Pragma operator . 178 6.11 Future language directions . 179 6.11.1 Floating types . 179 6.11.2 Linkages of identifiers . 179 6.11.3 External names . 179 6.11.4 Character escape sequences . 179 6.11.5 Storage-class specifiers . 179 6.11.6 Function declarators . 179 6.11.7 Function definitions . 179 6.11.8 Pragma directives . 179 6.11.9 Predefined macro names . 179 7. Library . 180 7.1 Introduction . 180 7.1.1 Definitions of terms . 180 7.1.2 Standard headers . 181 7.1.3 Reserved identifiers . 182 7.1.4 Use of library functions . 183 7.2 Diagnostics <assert.h> . 186 7.2.1 Program diagnostics . 186 7.3 Complex arithmetic <complex.h> . 188 7.3.1 Introduction . 188 7.3.2 Conventions . 189 7.3.3 Branch cuts . 189 7.3.4 The CX_LIMITED_RANGE pragma . 189 7.3.5 Trigonometric functions . 190 7.3.6 Hyperbolic functions . 192 7.3.7 Exponential and logarithmic functions . 194 7.3.8 Power and absolute-value functions . 195 7.3.9 Manipulation functions . 196 7.4 Character handling <ctype.h> . 200 7.4.1 Character classification functions . 200 7.4.2 Character case mapping functions . 203 7.5 Errors <errno.h> . 205 7.6 Floating-point environment <fenv.h> . 206 7.6.1 The FENV_ACCESS pragma . 208 7.6.2 Floating-point exceptions . 209 7.6.3 Rounding . 212 7.6.4 Environment . 213 7.7 Characteristics of floating types <float.h> . 216 Contents v