5 Star 25 Fork 16

YorkJia / cQueue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
example.c 821 Bytes
一键复制 编辑 原始数据 按行查看 历史
YorkJia 提交于 2020-05-03 19:59 . modify the example.c
#include <stdio.h>
#include <stdlib.h>
#include "cQueue.h"
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int i,j;
int *pmsg;
char perr;
cQueue_t *pq;
int *prx;
pq = cQcreate(110);
/* cQPost ...*/
for(i = 0; i < 100; i++){
pmsg = (int *)malloc(10*sizeof(int));
for(j = 0; j < 10; j++){
pmsg[j] = i*10 + j;
}
cQPost(pq, (void *)pmsg);
}
/* cQPostFront...*/
pmsg = (int *)malloc(10*sizeof(int));
for(j = 0; j < 10; j++){
pmsg[j] = 1000 + j;
}
cQPostFront(pq, (void *)pmsg);
/* cQRcv...*/
for(j = 0; j < 101; j++){
prx = (int *)cQRcv(pq, &perr);
printf("prx%3d:", j);
for(i = 0; i < 10; i++){
printf("<%4d>", prx[i]);
}
printf("\n");
}
cQDelete(pq);
return 0;
}
C
1
https://gitee.com/yorkjia/cQueue.git
git@gitee.com:yorkjia/cQueue.git
yorkjia
cQueue
cQueue
master

搜索帮助