当前位置: 技术问答>linux和unix
请教GCC编译的问题
来源: 互联网 发布时间:2016-09-06
本文导语: 各位兄弟 刚开始学LINUX 写了段测试代码: 怎么用gcc编译不过去呢? 代码如下: #include #include typedef struct Link_T{ Link_T *next; int data; }Node; Node *LinkInit(void) { Node *head = (Node *)malloc(sizeof(Node)); head->data = 0; head->ne...
各位兄弟
刚开始学LINUX
写了段测试代码:
怎么用gcc编译不过去呢?
代码如下:
#include
#include
typedef struct Link_T{
Link_T *next;
int data;
}Node;
Node *LinkInit(void)
{
Node *head = (Node *)malloc(sizeof(Node));
head->data = 0;
head->next = NULL;
return head;
}
Node *LinkAdd(Node *head,int data)
{
Node *pl = head;
Node *node = (Node *)malloc(sizeof(Node));
node->data = data;
node->next = NULL;
while(pl->next != NULL)
{
pl = pl->next;
}
pl->next = node;
return head;
}
void LinkDisP(Node *head)
{
Node *pl = head;
while(pl!= NULL)
{
printf("pl->data = %drn",pl->data);
pl = pl->next;
}
}
void main()
{
int i = 0 ;
Node *head = NULL;
head = LinkInit();
for(i = 0; i
刚开始学LINUX
写了段测试代码:
怎么用gcc编译不过去呢?
代码如下:
#include
#include
typedef struct Link_T{
Link_T *next;
int data;
}Node;
Node *LinkInit(void)
{
Node *head = (Node *)malloc(sizeof(Node));
head->data = 0;
head->next = NULL;
return head;
}
Node *LinkAdd(Node *head,int data)
{
Node *pl = head;
Node *node = (Node *)malloc(sizeof(Node));
node->data = data;
node->next = NULL;
while(pl->next != NULL)
{
pl = pl->next;
}
pl->next = node;
return head;
}
void LinkDisP(Node *head)
{
Node *pl = head;
while(pl!= NULL)
{
printf("pl->data = %drn",pl->data);
pl = pl->next;
}
}
void main()
{
int i = 0 ;
Node *head = NULL;
head = LinkInit();
for(i = 0; i