I am trying to implement a queue using arrays, however my initialization function doesn't seem to work. Even the first line of the function is not executed. Here is the struct, function and main:
#include <stdio.h>
#include <stdlib.h>
typedef struct queue queue;
struct queue{
int size, rear, front, length;
int *arr;
};
queue* init(queue *queue1){
queue1->size = 2;
queue1->front = -1;
queue1->rear = -1;
queue1->length = 0;
queue1->arr = (int*) malloc(sizeof(int)*queue1->size);
return queue1;
}
int main(){
queue* queue1 = init(queue1);
}