c¾µäÁ´±í³ÌÐò
#include "stdio.h"
#include "malloc.h"
typedef int elemtype;
struct node
{
elemtype data;
struct node *next;
};
typedef struct node NODE;
NODE * creat(NODE *head)
{
NODE *p,*q;
elemtype i;
head=(NODE*)malloc(sizeof(NODE));
scanf("%d",&(head->data));
p=head;
while(p->data!=0)//0Ϊ½áÊø·û
{
q=(NODE*)malloc(sizeof(NODE));
scanf("%d",&(q->data));
p->next=q;
p=q;
}
p->next=NULL;
return head;
}
void printlist(NODE *head)
{
NODE *p;
elemtype i=0;
p=head;
while(p->next!=NULL)
{
printf("the %d node\n",i);
i++;
printf("%d\n",p->data);
p=p->next;
}
printf("\n");
}
void main(void)
{
NODE *my_head;
my_head=(NODE *)malloc(sizeof(NODE));
my_head=creat(my_head);
printlist(my_head);
//getch();
}
Ïà¹ØÎĵµ£º
/* =========================================================================== */
/* Project: s3c44b0_lib & ......
/* =========================================================================== */
/* Project: mp3 player */
/* File: & ......
ÔÚANSI±ê×¼»¯ºó£¬CÓïÑԵıê×¼ÔÚÒ»¶ÎÏ൱µÄʱ¼äÄÚ¶¼±£³Ö²»±ä£¬¾¡¹ÜC++¼ÌÐøÔڸĽø¡££¨Êµ¼ÊÉÏ£¬Normative Amendment1ÔÚ1995ÄêÒѾ¿ª·¢ÁËÒ»¸öеÄCÓïÑÔ°æ±¾¡£µ«ÊÇÕâ¸ö°æ±¾ºÜÉÙΪÈËËùÖª¡££©±ê×¼ÔÚ90Äê´ú²Å¾ÀúÁ˸Ľø£¬Õâ¾ÍÊÇISO9899:1999£¨1999Äê³ö°æ£©¡£Õâ¸ö°æ±¾¾ÍÊÇͨ³£Ìá¼°µÄC99¡£Ëü±»ANSIÓÚ2000ÄêÈýÔ²ÉÓá£
¡¡¡¡ÔÚC99ÖаüÀ ......
ÔÚÏîÄ¿ÊôÐÔÒ³ --> ÅäÖÃÊôÐÔ --> C/C++ --> Êä³öÎļþÀïÃæ£¬½«»ã±àÊä³öµÄÏÂÀÁбí´ÓÎÞÁбíÑ¡ÔñΪÄãÐèÒª»ã±àÊä³öµÄÄÚÈÝ£¬±ÈÈ瓽öÁгö³ÌÐò¼¯(/FA)”£¬Èçͼ1-1£¬Í¼1-2£º
ͼ1-1
ͼ1-2
------------------------------------------------------------------------------------------------ ......