+ 1
What does this code mean??
queue = new int[100];
4 Antworten
+ 3
int *queue;
queue = new int[100];
//queue pointer is initialized to point 100 array of integers.
+ 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
+ 1
Thanks
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'.