关于链表的有关问题 坐等大神

关于链表的问题 坐等大神
#include <iostream>
using namespace std;
struct node
{
char data;
node *next;
};
node *create();
void showlist(node *head);
int main()
{
node *head;
head = create();
showlist(head);
return 0;
}
node *create()
{
node *head = NULL;
node *pend = head;
node *ps;
char temp;
cout << "请随便输入" << endl;
do {
cin >>temp;
if(temp != '#')
{
ps = new node;
ps -> data = temp;
ps -> next = NULL;
if (head = NULL)
{
head = ps;
}
else
{
pend -> next = ps;
}
pend = ps;
}
} while(temp != '#');
return head;
}
void showlist(node *head)
{
node *pread = head;
cout << "输出一段英文" << endl;
while (pread != NULL)
{
cout << pread ->data;
pread = pread ->next;
}
cout << endl;
}
想问一下 这个到底哪里错误了呢 编译没错 运行就挂掉了 这是书上的例子 我照着写下来的 可是过本了 还有 关于链表 我不懂 有大神能详细的解释下吗

------解决方案--------------------
if (head = NULL)
写错了, 应该是if (head == NULL),
以后这样写if (NULL == head)可以防止上面的错误