9index, break, user_name, CONSTANT, _member
Got this wrong on a test and I'm wondering where I can find the right answer. Would be highly appreciated. Thanks!
9index, break, user_name, CONSTANT, _member
Got this wrong on a test and I'm wondering where I can find the right answer. Would be highly appreciated. Thanks!
'9index' is wrong. You never start a variable name with numbers. After the first digit is okay.
'break' is a reserved word
9index
is not a valid identifier because it starts with a digit.
break
is not a valid identifier because it is a language keyword.
user_name
is a valid identifier.
CONSTANT
is a valid identifier
_member
may or may not be a valid identifier. The standard explicitly reservies a number of identifiers for use by the implementation (e.g. the compiler or standard library). Identifiers starting with an underscore are reserved at global scope, but not in other scopes (e.g. to name variables of automatic storage duration within a function). The danger with using reserved identifiers is that no diagnostic is required (i.e. the code can successfully compile) and the code has undefined behaviour.
Anything that is not a valid identifier cannot be used as a variable name (among other things).
All variable names must begin with a letter of the alphabet or an underscore( _ ). You also cannot use reserved keywords. user_name and _member are valid, the rest aren't. -edit- missed the CONSTANT not being CONST as mentioned in another answer.
CONSTANT
and not const