s数据结构问题,求大神帮忙解决,小弟智商着急

#include
#include

typedef struct _node
{
int data;
struct _node * next;
}Node;
typedef struct _list{
Node* head;
}List;

Node* add(Node* head,int number)
{
//add to linked-list
Node *p=(Node *)malloc(sizeof(Node));
p->data=number;
p->next=NULL;
//find the last
Node *last =head;
printf("%d",last);
if(last){
while(last->next){
last =last->next;
}
//attach to
last->next=p;
}else{
last=p;
}
return head;
}

void travel_L(Node *head){
Node * p;
if(head=NULL)
printf("xxx");
p=head->next;
while(p!=NULL){
printf("%d",p->data);
p=p->next;
}

}

int main(){
int number;
Node *head=NULL;
// printf("%d",head);
do{
scanf("%d",&number);
if(number!=-1){
head=add(head,number);

    }
}while (number!=-1);
travel_L(head);
return 0;

}

你==写成=了

    if(head==NULL)
    {
        printf("xxx");
        return;
    }
 // app1.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include<stdio.h>
#include<stdlib.h>

typedef struct _node
{
    int data;
    struct _node * next;
}Node;
typedef struct _list{
    Node* head;
}List;

Node* add(Node* head,int number)
{
    //add to linked-list
            Node *p=(Node *)malloc(sizeof(Node));
            p->data=number;
            p->next=NULL;
            //find the last
            Node *last =head;
            //printf("%d",last->data);
            if(last){
                while(last->next){
                    last =last->next;
                }
                //attach to
                last->next=p;
            }else{
                last=p;
            }
            return last;
}

void travel_L(Node *head){
    Node * p;
    if(head==NULL)
    {
        printf("xxx");
        return;
    }
    p=head->next;
    while(p!=NULL){
        printf("%d\n",p->data);
        p=p->next;
    }

}

int main(){
    int number;
    Node *head=NULL;
    Node *head1=NULL;
    head1=add(head1,0);
    head = head1;
//  printf("%d",head);
    do{
        scanf("%d",&number);
        if(number!=-1){

            head1=add(head1,number);


        }
    }while (number!=-1);
    travel_L(head);
    return 0;
}

有什么问题,你说清楚呀,只看到有个if()里的等号写错了。