c语言链表简单有关问题

c语言链表简单问题
#include<stdio.h>
#include<stdlib.h>
#include <string.h>
struct linknode //建立链表节点
{
char data; //需要更通用的数据类型
struct linknode *next;
};
struct link
{
struct linknode *head;
struct linknode *tail;
};
struct linknode *create() //创建链表,接受INT型值
{
char datas;
struct linknode *head,*temp,*tail;
head=tail=NULL;
while(scanf("%c",&datas)==1) //输入方式有待改进
{
temp=(struct linknode *)malloc(sizeof(struct linknode));
if(temp==NULL)
printf("allocate erro!");
else
{
temp->data=datas;
temp->next=NULL;
if(head==NULL)
head=tail=temp;
else
{
tail->next=temp;
tail=temp;
}
}
}
return head;
}
void print(struct linknode *head) //打印链表
{
struct linknode *p;
p=head;
while(p)
{
printf("%c\t",p->data);
p=p->next;
}
}

struct linknode *findAhead(struct linknode *head,char datas) //查找特定值得前一个节点
{
struct linknode *p,*q;
q=NULL;
p=head;
while(p->data!=datas&&p->next!=NULL)
{
q=p;
p=p->next;
}
if(p->data==datas)
return p;
else
return NULL;
}

int main() //链表建立测试
{
struct linknode *head,*fd;
head=create();
print(head);
fd=findAhead(head,'q');
if(fd==NULL)
{
printf("Ahead of found is NULL.");
printf("\n");
}
else
{
printf("\n");
printf("%d\n",fd->data);
  exit(1);
}

return 0;
}

题目要求用户一个一个地输入字符,当输入q时,打印出前面输入的字符并结束程序,注意不要内存泄露。为什么当我输入q时程序没有结束?

------解决方案--------------------
你都没有加判断语句……当然输入'q'时不会结束

C/C++ code
while(scanf("%c",&datas)==1) //输入方式有待改进
{
    if ( data == 'q' )
        break;