64,683
社区成员
发帖
与我相关
我的任务
分享
/**************** list.h ********************/
typedef struct {
void **item;
int num;
} LIST;
#ifdef WIN32
#ifdef __cplusplus
extern "C" {
#endif
extern int AppendItem(LIST *pList,void *pItem);
#ifdef __cplusplus
}
#endif
#else
extern int AppendItem();
#endif
/**************** list.c ********************/
int AppendItem(pList,pItem)
LIST *pList;
void *pItem;
{
void **pItems;
if(pList->num>0 && pList->num%LIST_BLOCK_SIZE==0)
{
pItems=realloc(pList->items,
(pList->num+LIST_BLOCK_SIZE)*sizeof(void*)
);
if(pItems==NULL)
return(-1);
pList->item = pItems;
}
pList->item[pList->num] = pItem;
pList->num++;
return(0);
}
#include <stdio.h>
#include <stdlib.h>
int kick();
int main()
{
int i = 1;
kick(i);
getchar();
return 0;
}
int kick(int i)
{
printf("----");
}