#include <stdio.h>

  2 #include <stdlib.h>

  3 typedef struct Node* PtrToNode;

  4 typedef PtrToNode List;

  5 typedef PtrToNode Position;

  6 

  7 typedef struct

  8 {

  9         char* studentID;

 10         char* studentName;

 11 }ElementType;

 12 

 13 struct Node

 14 {

 15         ElementType Element;

 16         PtrToNode next;

 17 }; 

 18 

 19 

 20 

 21 


 23 int main()

25 {

 26         FILE * fp=fopen("abc.txt","rt");

 27         char* X;

 28         fscanf(fp,"%s",X);

 29         printf("%s",X);

 30 

 31         Position Temp;

 32         Temp=malloc(sizeof(struct Node));

 33 

 34         fscanf(fp,"%s",Temp->Element.studentID);

 35         printf("%s",Temp->Element.studentID);

 36 

 37         return 0;

 38 }

  
연결리스트 과제하는중에 메모장을 이용한 파일입출력 되는지 알아보려고 

위에 처럼 짯는데 파일 실행하면 

Segmentation fault (core dumped)

라고 뜹니다.


뭐가 잘못된건가요;