+ 1
Doubt in Queue Management code in C++
This is what I understand: queue is initialised as a pointer. Then it is given a memory location in the heap for holding an array using new. This is what I don't understand: When queue is a pointer, how can we write queue[i] and perform other functions on it without derefencing it. So shouldn't we use *queue[i] instead? Help me understand this, please. Thank You https://code.sololearn.com/cPBr66cOIjtR/?ref=app
2 odpowiedzi
+ 1
queue[0] is the same thing as *queue. The [0] specifies the contents at offset 0. Just like you could use queue[5] or alternatively *(queue + 5).
0
Jerry Hobby Is this just for arrays?