Why does the program crash? Although sometimes it doesn't. I'm using visual studio 2017. I've run my entire program (more functions) with an online compiler and it doesn't crash. Thank you.
[1
[
]2
#include <stdio.h>
#include <stdlib.h>
typedef struct Node {
int data;
struct Node* next;
}node;
typedef struct {
int count;
node *front;
node *rear;
}QueueHead;
QueueHead *CreateQueue(){
QueueHead *myQH = (QueueHead*)malloc(sizeof(myQH));
//Empty list is created.
//Emelent counter is set to zero
myQH->count = 0;
//Top should address NULL as it is an empty list
myQH->front = NULL;
myQH->rear = NULL;
return myQH;
}
int main() {
QueueHead *myQH = CreateQueue();
}