단순 연결 리스트가 오류가 납니다.

익명 사용자의 이미지

연결 리스트를 공부하는 중인데 딱히 틀린게 느껴지지 않는데 번호와 name을 입력 받고나면 while문이 돌지 않고 실행이 종료 됩니다. 무엇이 문제인가요?

#include <stdio.h>
#include <string.h>
#include <malloc.h>
struct nodeType {
	int num;
	char* name;
	nodeType* pre;
};
int main(){
	int num;
	char* name;
	nodeType* newnode;
	nodeType* head;
	nodeType* cur;
	nodeType* prenode;
	head=NULL;
	printf("노드구조의 번호:");
	scanf("%d",&num);
	while(num!=0){
		printf("\n이름: ");
		scanf("%s",name);
		newnode=(nodeType*)malloc(sizeof(nodeType*));
		newnode->num=num;
		newnode->name=name;
		newnode->pre=NULL;
		if(head==NULL){
			head=newnode;
		}
		else{
			cur=head;
			while(cur!=NULL){
				prenode=cur;
				cur=cur->pre;
			}
			prenode->pre=newnode;
		}
		printf("success");
	}
}

그리고 while문이 끝나면 모든 노드를 출력하고 싶은데 어떻게 코딩을 해야할까요...