Checking for valid Identifiers – CSKC
Sign In

Search

Solved Problem #CPP#1782    siteicon   siteicon  

Problem Statement - Checking for valid Identifiers

Find the valid and invalid identifiers in the following piece of code segment.

int argument=123;
char c#='#';
float amar_is_a_beautiful_boy=3.45;
int taj mahal=1;
int break=0;
string file.ext="myfile.txt";
cout<<argument<<endl;
cout<<c#<<" "<<amar_is_a_beautiful_boy<<" "<<taj mahal<<endl;
cout<<break<<file.ext<<endl;

Solution

TC++ #1782

×

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

Valid Identifiers are:
argument
amar_is_a_beautiful_boy

 

Invalid Identifiers are:
c#  (# is not allowed)
taj mahal (space between words is not allowed. they can be separate identifiers if separately declared)
break (keyword can not be used as identifier)
file.ext (. is not allowed in the identifier)

 


Share

Created: 18-Dec-2017 21:17 | Updated: 18-Dec-2018 20:06|