Re: ***SPAM*** Code dslk ! Thầy ơi,em làm sai chỗ nào mà F5 nó ko chạy ?

0 views
Skip to first unread message

Toan Nguyen Van

unread,
Aug 6, 2010, 9:21:35 PM8/6/10
to Tan Tran, ctdl-he2010
Chào em!
Ngay hàm đầu tiên là sai rồi

pnode khoitao(pnode phead)
{   pnode phead;
    phead=NULL;
    return phead;
}

như thế trong ham khoitao có đến 2 biến phead ??? Máy tính sẽ báo lỗi

--------------------------------------------
Nguyễn Văn Toàn
Trường Đại học Công nghệ thông tin - ĐHQG HCM
ĐT: 0903761559
Email: toa...@uit.edu.vn


2010/8/5 Tan Tran <revolut...@gmail.com>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
typedef struct tagnode
{
    int info;
    struct node* pnext;
}node,* pnode;

pnode khoitao(pnode phead)
{   pnode phead;
    phead=NULL;
    return phead;
}
pnode themdau(pnode phead,int x)
{
    pnode p;
    p=new node
    p->info=x; p->pnext=NULL;
    
    p->pnext=phead;
    
    phead=q;
    return phead;
}

void nhapds(pnode phead)
{
    int n,i,x;
    pnode p;
    printf("nhap so luog node n= ");scanf("%d",&n);
    for (i=0;i<n;i++)
            {
            fflush(stdin);scanf("%d",x);themdau(p,x);
            }
}
void indslk(pnode phead)
{
    pnode p;
    p=phead;
    while (p!=NULL)
    {
        printf(" %d  ",p->info);
        p=p->pnext;
    }
    
}
void main()
{
    pnode phead;
    int x;
    khoitao(phead);
    nhapds(phead);
    indslk(phead);
    
}
    


Reply all
Reply to author
Forward
0 new messages