- 8

What are legal variables names given below? 1.*!is_legal 2.think_is_legal 3.13legal_name 4.notLegal

24th Jan 2017, 2:47 PM
P. Anitha
7 Answers
+ 4
The second and the last are legal, the other two ain't. (1. Has special characters, 3. Starts with a number.) - The variables names can't start with a number. * example (legal): var69_a * example (illegal): 69var_a - The variables names can't have any special characters ($, @, !, ?, &, *......) except an underscore '_'. * example (legal): snake_1 * example (illegal): $nake#1 - The variables names shouldn't contain a keyword or a reserved word (return, int, cout, while...). * example (illegal): if_else_vn
24th Jan 2017, 11:37 PM
Bodan Talev
Bodan Talev - avatar
+ 3
2.think_is_legal 4.notLegal
18th Mar 2018, 2:36 PM
Mahnoor Shahzad
Mahnoor Shahzad - avatar
+ 1
just run the code and if it compiles without error it is valid 😜😜😜 !!! Remember: 1. A variable cannot start with a number . 2. It cannot have and special character except underscore _ . 3. It should not contain any keyword or reserved word !!!
24th Jan 2017, 2:50 PM
Siddharth Naithani
Siddharth Naithani - avatar
0
think is legal and notLegal
20th May 2020, 9:20 PM
Ubi Thomas
Ubi Thomas - avatar
- 1
15th Apr 2020, 6:20 PM
K.Ruthra
- 2
1. Illegal 2. Legal 3. Illegal 4. Legal
24th Jan 2017, 9:01 PM
Siddharth Naithani
Siddharth Naithani - avatar