Ejemplo n.º 1
0
Archivo: main.c Proyecto: leeyun1533/C
int main(){
    
    struct NODE *head =malloc(sizeof(struct NODE));
    
    head->next=NULL;
    addFrist(head,10);
    addFrist(head,20);
    addFrist(head,30);
    
    struct NODE *curr=head->next;
    while (curr!=NULL) {
        
        printf("%d\n",curr->data);
        curr=curr->next;
    }
    
    curr=head->next;
    
    while (curr!=NULL) {
        
        struct NODE *next=curr->next;
        free(curr);
        
        curr=next;
    }
    
    free(head);
}
Ejemplo n.º 2
0
void InitFirst(firstnode* F,string file)		//First集初始化,书上开始用于检查
{												//是否可达空字符的过程
	sets* a=CreateSets(file);
	int tag=1;
	while(tag)
	{
		tag=0;
		sets* b=a->next;
		while(b)
		{
			if(judgeEnd(b->head,a))
			{
				addFrist(b->head,'$',F);
				dcreaseEnd(a,b->head);
				tag=1;
			}
			b=b->next;
		}
	}
	/*sets* y=a->next;						//查看内容可打开
	charset* ch=NULL;
	printf("\nNot End In Init:%c\n");

	while(y)
	{
		printf("\nNot End:%c\n",y->head);
		ch=y->cs;
		while(ch)
		{
				printf("%c,",ch->c);
			ch=ch->next;
		}
		y=y->next;
	}*/

	/*firstnode* t=F->next;
	charset* te=NULL;
	while(t)
	{
		printf("\nNot End Point: %c\n",t->cur);
		te=t->cs->next;
		while(te)
		{
			printf("%c,",te->c);
			te=te->next;
		}
		t=t->next;
	}*/

}