How can we directly save users input at some memory address in c++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can we directly save users input at some memory address in c++?

If user enter a value we usually save it using some variable and also access it using that variable. eg. int a; // declaration cin>>a;. // assigning value cout>>a; // accessing value here this variable a has some memory address and we can also access it using pointer.. but what if we don't like to create so much of variable in a program? I would like to save users input directly to a memory address..and not to any variable..! please explain me in detail how to do it?

18th Jul 2018, 2:07 PM
Suraj Jha
Suraj Jha - avatar
4 Answers
+ 2
Borislav Kalinski could​you give me an example
18th Jul 2018, 5:32 PM
Suraj Jha
Suraj Jha - avatar
+ 1
A variable its the content of a memory adress, then .....
18th Jul 2018, 4:01 PM
KrOW
KrOW - avatar
+ 1
Do you know assembler? In C++ you can use assembler code using _asm { put here assembler code}. In assembler you can access directly CPU registers. Every variable you create is saved in this registers.
18th Jul 2018, 5:01 PM
B K
- 1
You need a variable to access the content of a memory location.
29th Sep 2019, 12:36 PM
Piyush Yadav
Piyush Yadav - avatar