+ 2
int **p = new int*[100]
What does it means please clarify?
13 Answers
+ 2
these are multidimensional arrays i.e. an array of arrays
it can be fully qualified as
int**p= new int[100][100]
+ 3
p is an array of 100 pointers.
`new int*[ number ]` creates an array with <number> pointers.
`int **p` can be rewritten as `int* *p`, which can be rewritten as `int* p[ <size of array> ]`
https://www.quora.com/What-is-int-x-new-int-n/answer/Slava-Osipov?ch=10&share=f35ae599&srid=iwqHc
----
Edit: Thanks Ritwik for correcting me
+ 3
Ritwik, Thanks for telling me 😇 may you please explain what I got wrong?
+ 3
p is an integer pointer to an array of 100 integer pointer values but the new function is used to allocate memory dynamically during run time
+ 2
Actually in offline compilers unlike sololearn we first have to compile our code then run it
+ 2
Ritwik, Oh,, I see my mistake 🤦🏻♂️ thanks for correcting me
+ 2
Compiling turns into binary language
+ 2
And run executes it
+ 2
So normal variables are declared during compile time
+ 2
But adding (new) stores them during run time
+ 1
Edwin you are a little wrong
+ 1
Which can help to take the number of values from the user
0
My pleasure Edwin