c - is a compound literal not a literal? -
from c in nutshell:
chapter 3 literals
in c source code, a literal token denotes a fixed value, may integer, floating-point number, character, or string. literal’s type determined value , notation.
the literals discussed here different compound literals, introduced in c99 standard. compound literals ordinary modifiable objects, similar variables. full description of compound literals , special operator used create them, see chapter 5.
so literal has fixed value, i.e. value can't modified, while compound literal has modifiable values.
according that, 1 correct:
- a compound literal not literal, or
- the definition of literal should extended include compound literal becomes 1 exception fixed-value rule?
thanks.
the c11 standard never defines "literal" on own. speaks of "string literal" , "compound literal" individually.
tokens such 0
, 0.0
, a
in enum { }
, , '\0'
called "constants" collectively, , "integer constants", "floating-point constants", "enumeration constants", , "character constants" respectively.
Comments
Post a Comment