Add file nzg_msgList.c for message list

This commit is contained in:
Glenn Y. Rolland 2019-09-17 14:14:46 +02:00
parent 00e8c700fc
commit 37b871297f

33
src/nzg_msgList.c Normal file
View file

@ -0,0 +1,33 @@
#include "libnazgul.h"
/* ajout dans la liste */
msgSpaceListElem *addBegining( msgSpaceListElem*list,int ownerpid){
msgSpaceListElem *unSpacemsgListElem;
if( (unSpacemsgListElem=(msgSpaceListElem *)malloc(sizeof(msgSpaceListElem) ) )==NULL){
perror("ereur dallocation de memoire");
exit(1);}
unSpacemsgListElem->ownerPid = ownerpid;
return(unSpacemsgListElem);
}
int test(int argc,char **argv){
msgSpaceListElem *ma_liste;
msgSpaceListElem *listMove;
ma_liste=NULL;
ma_liste=addBegining(ma_liste, 3);
ma_liste=addBegining(ma_liste, 6);
ma_liste=addBegining(ma_liste, 5);
for (listMove=ma_liste ;listMove!=NULL ; listMove=listMove->next)
{
printf("valaeur :%d\n",listMove->ownerpid);
}
return(0);
}