I create a Queue
that includes a two dimensional array, the size of every element of that array is 2. An Exception occurs when I enqueue a 2-size array in the queue.
The following is my code:
#include "stdio.h"
#define size 1000
typedef struct Queue {
int *data[2];
int front;
int rear;
}Queue;
void init(Queue *q)
{
q->front=0;
q->rear=0;
}
void Enqueue(Queue *q,int *value)
{
if(q->rear==size)
return ;
q->data[q->rear++]=value;
}
void main()
{
Queue q[1];
init(q);
int a[10][2];
for(int i=0;i<10;i++) {
a[i][0]=i;
a[i][1]=i*2+1;
Enqueue(q,a[i]);
}
}