Can we ask to the user how many layer of pointers do you want? In C++ program. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can we ask to the user how many layer of pointers do you want? In C++ program.

Int ***p; //it's a triple layered pointer. Int (N-times *) p; //can we make something like this. I want my user decide what type of pointer he/her wants in runtime.

8th Sep 2021, 3:26 PM
Commander Erwin Smith
Commander Erwin Smith - avatar
1 Answer
+ 2
I don't think so Because no matter what a pointer is pointing to, it itself is a statically allocated object, so it's type should be known at compile time.
8th Sep 2021, 3:50 PM
Arsenic
Arsenic - avatar