enum ev_type { ARRIVAL, DEP_Q0, DEP_Q1, DEP_Q2, DEP_Q3 };
struct node {
double time;
double duration;
enum ev_type event;
struct node * next;
}*evlist;
typedef struct node *nptr;
double min = 0;
void generate_new_customer(double clock, double duration)
{
nptr newev = (nptr)malloc(sizeof(nptr));
newev->duration = duration;
newev->time = min;
newev->event = ARRIVAL;
if (evlist == NULL)
{
evlist = newev;
evlist->next = NULL;
}
else
{
newev->next = evlist;
evlist = newev;
}
printf("%lf\n", evlist->time);
}
int main() {
start();
while (1) {
generate_new_customer(1, 6);
if (min > 480)
break;
min++;
}
return 0;
}
I'm trying to memory allocation using function. The function working by value of min. If min increase by 480 it stops and break. I checked it. But still debug assertion failed error happen. what should I do?