Correct Identifiers – CSKC
Sign In

Search

Solved Problem #CPP#5343    siteicon   siteicon  

Problem Statement - Correct Identifiers

Only 4 out of 10 names written below can be used as variable names or identifiers by a C++ programmer, can you name them.

4PIN
PIN_$
Identifier
PIN_4
P.I.N.
numb_er
Srl.No.
_SIMPLE_INTEREST
FOUR@IDENTIIFERS
FOUR NAMES

Solution

TC++ #5343

×

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

Following 4 can be used correctly as variable names or identifiers.
Identifier
PIN_4
numb_er
_SIMPLE_INTEREST

Notes

4PIN  //This is not as it starts with a number
PIN_$  //This contains $ which is not allowed
Identifier  //This is OKAY
PIN_4  //This is OKAY
P.I.N.   //This is not as it contains . which is not allowed
numb_er  //This is OKAY. _ is allowed
Srl.No.  ////This is not as it contains . which is not allowed
_SIMPLE_INTEREST //This is OKAY. _ is allowed at first position also
FOUR@IDENTIIFERS  //This is not as it contains @
FOUR NAMES   //This is not as it contains space character.

Identifier rules can be learnt from
http://computersirkiclass.com/?p=1601&tag=cp003-tokens-keyword-and-identifiers


Share

Created: 8-Dec-2018 23:20 | Updated: 22-Mar-2026 20:20|