First Upload

This commit is contained in:
2022-02-25 15:33:16 +02:00
commit 0c74d10f0d
295 changed files with 74784 additions and 0 deletions

32
17 - Queue/ex1.c Normal file
View File

@@ -0,0 +1,32 @@
#include "Lib.h"
void InitQueue(queue * q)
{
(*q).items = ZERO;
}
void InsertQueue(queue * q, Data_Type item)
{
if (!((*q).items))
{
(*q).values = (Data_Type *)malloc((++((*q).items)) * sizeof(Data_Type));
}
else
{
(*q).values = (Data_Type *)realloc((*q).values, ((++((*q).items)) * sizeof(Data_Type)));
}
*((*q).values + (*q).items - ONE) = item;
}
Data_Type RemoveQueue(queue * q)
{
if (!((*q).items))
{
(*q).values = (Data_Type *)malloc((++((*q).items)) * sizeof(Data_Type));
}
else
{
(*q).values = (Data_Type *)realloc((*q).values, ((++((*q).items)) * sizeof(Data_Type)));
}
*((*q).values + (*q).items - ONE) = item;
}