What is the c++ code for recognizing a valid c++ identifier? there are some conditions to be followed:
1. it should start with a letter or an underscore
2. no two succeeding underscore.
3.the length of the identifier is from 1 to 8 characters only.
4. a single underscore inputted as an identifier is invalid.
here are the codes that i coded that are very much familiar with the problem. all i need is to combine them as one code that solves the problem above.:
/*THIS IS A SIMPLE CODE TO RECOGNIZE AN IDENTIFIER*/
1. it should start with a letter or an underscore
2. no two succeeding underscore.
3.the length of the identifier is from 1 to 8 characters only.
4. a single underscore inputted as an identifier is invalid.
Wrong.
1. It must start with a Latin alphabet character (A-Z and a-z) or an underscore (_).
2. After the first character, it may contain only Latin alphabet characters, Arabic numerals (0-9), or underscores.
3. There's no limit to the length of the identifier.
4. They're case-sensitive
Therefore: a is valid; A is valid and also a different identifier; 1 is invalid; _ is valid; __ is valid; _1 is valid; __1 is valid; 1_ is invalid.