Expression C# là gì
ExpressionsFrom cppreference.com < c | language C LanguageHeadersType supportProgram utilitiesVariadic function supportError handlingDynamic memory managementDate and time utilitiesStrings libraryAlgorithmsNumericsInput/output supportLocalization supportAtomic operations (C11)Thread support (C11)Technical Specifications [edit] C language Basic conceptsKeywordsPreprocessorStatementsExpressionsInitializationDeclarationsFunctionsMiscellaneousHistory of CTechnical Specifications [edit] Expressions Generalvalue categoryevaluation order and sequence pointsconstant expressionsimplicit conversionsgeneric selectionconstants and literalsinteger constantfloating constantcharacter constantstring literalcompound literaloperatorsoperator precedencemember access and indirectionlogical operatorscomparison operatorsarithmetic operatorsassignment operatorsincrement and decrementfunction call, comma, conditional operator sizeof _Alignof (C11) [edit] An expression is a sequence of operators and their operands, that specifies a computation. Show Expression evaluation may produce a result (e.g., evaluation of 2+2 produces the result 4), may generate side-effects (e.g. evaluation of printf("%d",4) sends the character '4' to the standard output stream), and may designate objects or functions. [edit] General
[edit] OperatorsCommon operatorsassignmentincrementdecrementarithmeticlogicalcomparisonmember accessother a = b ++a +a !a a == b a[b] a(...)
[edit] Conversions
[edit] Other
[edit] Primary expressionsThe operands of any operator may be other expressions or they may be primary expressions (e.g. in 1+2*3, the operands of operator+ are the subexpression 2*3 and the primary expression 1). Primary expressions are any of the following: 1) Constants and literals (e.g. 2 or "Hello, world") 2) Suitably declared identifiers (e.g. n or printf) 3) Generic selections (since C11)Any expression in parentheses is also classified as a primary expression: this guarantees that the parentheses have higher precedence than any operator. [edit] Constants and literalsConstant values of certain types may be embedded in the source code of a C program using specialized expressions known as literals (for lvalue expressions) and constants (for non-lvalue expressions)
[edit] Unevaluated expressionsThe operands of the sizeof operator are expressions that are not evaluated (unless they are VLAs) (since C99). Thus, size_t n = sizeof(printf("%d", 4)); does not perform console output. The operands of the _Alignof operator, the controlling expression of a generic selection, and size expressions of VLAs that are operands of _Alignof are also expressions that are not evaluated. (since C11)[edit] References
[edit] See alsoC++ documentation for Expressions Retrieved from "https://en.cppreference.com/mwiki/index.php?title=c/language/expressions&oldid=130679" |