Initialize queue
// case of dynamic data memory size_t memsize = qQueueSize(10, sizeof(struct myobj)); void *datamem = malloc(memsize); Q_QUEUE queue; if(qQueueInit(&queue, datamem, memsize, sizeof(int)) == 0) { printf("Can't initialize queue.\n"); return -1; } // case of static data memory char datamem[1024]; Q_QUEUE queue; if(qQueueInit(&queue, datamem, sizeof(datamem), sizeof(int)) == 0) { printf("Can't initialize queue.\n"); return -1; }
|