Queue question

My textbook lists the function below. Can someone explain to me what this line meanslist=new Type[maxQueueSize];? Especially the part about Type, what does it represent? I thought it was referring to a datatype so I tried int and arrayQueueType but neither worked.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
arrayQueueType::arrayQueueType(int queueSize)
{
     if(queueSize <= 0)
     {
       cout<<"Size of the array to hold the queue must be positive"<<endl;
       cout<<"creating an array of size 100"<<endl;
       
       maxQueueSize=100;
     }
     else 
     maxQueueSize=queueSize;
     
     queueFront=0;
     queueRear=maxQueueSize-1;
     count=0;
     list=new Type[maxQueueSize];
} 
Type is a type; it can be anything. I would assume the problem is the type of list.

Further info: http://cplusplus.com/doc/tutorial/dynamic/

How is "list" declared?
int list;
edited. I was looking at a different program. Its not a pointer.
Last edited on
Then it should be
list = new int[maxQueueSize];

Does that not work?

EDIT: (you changed your post!) No, it won't work, because "list" isn't a pointer.
Try changing the declaration to int* list;
Last edited on
No, it says invalid conversion from from int to int.
list must be a pointer for that to work.
Please copy and paste the exact error message in its entirety.
Sorry. I fixed it. list actually should have been a pointer. I'm working on too many programs at the same time. Thanks for the help.
Topic archived. No new replies allowed.