+ 1

What does this code mean??

queue = new int[100];

16th Feb 2022, 1:23 PM
DevAbdul
DevAbdul - avatar
4 Answers
+ 3
int *queue; queue = new int[100]; //queue pointer is initialized to point 100 array of integers.
16th Feb 2022, 1:43 PM
Jayakrishna 🇼🇳
+ 1
But what I really don't understand is why do we have to use new, and why do we use 'int' as the name of the array
16th Feb 2022, 1:44 PM
DevAbdul
DevAbdul - avatar
+ 1
Thanks
16th Feb 2022, 2:03 PM
DevAbdul
DevAbdul - avatar
0
queue is the name pointer, not int. int is the type of data it can hold. 'new' creates or allocates required locations in memory . A single integer data, needs 4bytes to be stored in memory, so total 100*4=400 bytes are reserved to store integer data type data. You can access those by pointer name 'queue'.
16th Feb 2022, 1:52 PM
Jayakrishna 🇼🇳