How can I make the user to enter a specific name so that name become my variable's identifier ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I make the user to enter a specific name so that name become my variable's identifier ?

C++ identifiers

16th May 2020, 6:40 PM
The Unknown
The Unknown - avatar
4 Answers
+ 2
It is not possible.
16th May 2020, 6:53 PM
R_3-dr
R_3-dr - avatar
+ 1
Making self-modifying code is almost always considered bad practice. However, if it makes sense for you to explore the idea, then consider having your program modify the text of its source code file(s). This idea is called a program generator - i.e. a program that generates source code according to given parameters. Taking the idea further, it can be used to multiply your coding productivity. That's about as close as you can get to implement your request.
17th May 2020, 6:34 AM
Brian
Brian - avatar
+ 1
Though I have written code generators, I no longer have access to those sources. They are with former employers. Feel free to innovate. You can use RegEx to search and replace patterns in code template files. I observed in the 2000's that a book or two were published on the subject. Also I believe commercial software exists for the purpose. Try Google.
25th May 2020, 2:12 AM
Brian
Brian - avatar
0
Brain can you give me a code for this ?
24th May 2020, 9:40 PM
The Unknown
The Unknown - avatar