1.

Which of the following is a correct identifier in C++?(a) 7var_name(b) 7VARNAME(c) VAR_1234(d) $var_nameThis question was posed to me during an interview.My enquiry is from Basics topic in portion Basics Concepts of C++ of C++

Answer»

The correct choice is (C) VAR_1234

For explanation: The rules for writing an identifier is as follows:

i) may CONTAIN lowercase/uppercase letters, digits or UNDERSCORE(_) only

ii) should START with a non-digit character

iii) should not contain any SPECIAL characters like @, $, etc.



Discussion

No Comment Found

Related InterviewSolutions