Hello,
I am have a programming assignment where I need to simulate a store's waiting line for check out.

I am a little confused about the struct declaration, can someone please help me make sure i'm on the right track, b4 I dive into working on this program?

Code:
```struct queue{
int * element; //an array that will later be allocated using malloc representing each persons position in the line?
int front; //points to the front of the queue?
int numElements //the current size of the queue ?
int queueSize  //this is the max size of the queue?

}```

2. This seems reasonable.

The elements array is probably going hold a number representing each customer. The order they are stored will show the position. So if three entries in element are 5,1,3 it means that customer 5 is in front of the line, 1 is next, and 3 is in back.

front is an index into the elements array showing the first valid entry of the queue. This will also start as 0, but will be moved once you start removing entries from the queue.

The names of the last two are what you guessed, but it's hard to tell which is which. One is the total size of the elements array and the other is the number of entries currently in the queue. I use size below to refer to the total that you could possibly hold, compared to length which is how many elements are currently in the queue. You can use the names in your struct, just be consistent on which is which - if it makes sense to you that's what matters (comment the code well - it will help).

The size will be set once, when you allocate element. This has to be done first before you use the queue for anything.

The length will initially be 0. Each time you add an entry, you'll increase the length. This will let you find the last valid entry of the queue (element[front + length - 1]).

Each time you take something out of the queue, you return the value element[front] then add 1 to front. Each time you add something, copy it into element[front+length] and add 1 to length.

The when you get to the end of the queue you wrap around to the front. So the first entry is really element[(front + length - 1) % size] - the % size just wraps around from element[size - 1] back to element[0]. Same with the element you insert into.

You'll have to make sure that length is less than size when you insert - it's a basic check that the queue is big enough. When removing you'll check to see that length > 0, otherwise the queue is empty.

3. Thanks for the response....!

"[Warning] Struct queue declared inside parameter list"

4. Your actual struct, or it's forward declaration needs to be visible before the function prototype.

Code:
```// This
struct queue{
int * element; //an array that will later be allocated using malloc representing each persons position in the line?
int front; //points to the front of the queue?
int numElements //the current size of the queue ?
int queueSize  //this is the max size of the queue?

};

// Or this
struct queue;

// before this
void foo ( struct queue *q );```