Identify errors in the variable names – CSKC
Sign In

Search

Solved Problem! #CPP#2342    siteicon   siteicon  

Problem Statement - Identify errors in the variable names

Identify errors in the following variable names and suggest the best alternative name(s) for the given variable.

1)   Alt-text
2)  3M_Company
3)  interest#5
4)  P$
5)  (WonderDrug)

TC++ #2342

×

Ask AI About This Code

Default Prompt that is passed along with the code is given below, You can write your own prompt if you so desire.



×

Test CPP

Solution


1) Alt-text
Variable name can not contain special characters other than _ (underscore).Suggested name would be alt_text

2)  3M_Company
variable name can not begin with a number.  Suggested name would be _3M_Company or Company_3M

3)   interest#5
# is a special symbol and only _ is allowed. So we can have interest_5

4)  P$
$ is also a special symbol. Once can use P_dollar, P_ or simply P.

5)  (WonderDrug)
( and ) are also special symbols. One can use _WonderDrug_ or simply Wonder_Drug or WonderDrug.


Share

Created: 7-Jan-2018 22:20 | Updated: 29-Nov-2018 17:15|