Which of the following identifiers are invalid, Papername, - ProProfs Discuss
Advertisement

Which of the following identifiers are invalid, Papername, Writername, Typename, Printname?

Which of the following identifiers are invalid, Papername, Writername, Typename, Printname?<br/>

Change Image    Delete

Asked by Allcompiler, Last updated: Apr 19, 2024

+ Answer
Request
Question menu
Vote up Vote down

4 Answers

J.Spencer

J.Spencer

Knowledge Enthusiast, Knows A Lot of Stuff.

J.Spencer
J.Spencer, Knowledge enthusiast, Tokyo

Answered Sep 17, 2018

The answer is Typename.

Typename cannot be used as an identifier because it is a reserved keyword for C++. It is used when writing templates in C++. It specifies that a dependent variable name in a template definition is a type in itself. It is used as an alternative keyword to 'class'.

upvote downvote
Reply 

N. Kingsley

N. Kingsley

N. Kingsley
N. Kingsley, Writer, Columbus

Answered Jul 11, 2018

The answer to this is the Typename. This cannot be used as an identifier because it will not be able to communicate its meaning properly. If you truly want an identifier to be recognized, you need to use its parameters and its members. If in case you see the need to use a type name, you should choose a language-independent name as this can make it more identifiable.

If this violation is done, do not worry because it can easily be fixed. The type name can easily be changed with a parameter or a member. If you continue trying to use a type name as an identifier, expect that you will get the error message soon enough and you cannot progress.

upvote downvote
Reply 

John Adney

John Adney

John Adney
John Adney

Answered Feb 12, 2017

Why we can't use typename as identifier
upvote downvote
Reply 

John Smith

John Smith

John Smith
John Smith

Answered Nov 03, 2016

Typename
upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

Email Sent
We have sent an email to your address "" with instructions to reset your password.