C:linked list
#include<stdio.h>
#include<stdlib.h>
struct IntNode
{
int data;
struct IntNode *next;
};
typedef struct IntNode intNode;
int main()
{
intNode *node1 = NULL , *node2 = NULL , *node3 = NULL;
node1=(intNode *)malloc(sizeof(intNode));
node1->data = 1;
node1->next = node2;
node2->data = 2;
node2->next = node3;
node3->data = 3;
node3->next = NULL;
printf("%d\n",node1);
}
complied with gcc, but it displays"segmentation fault" message,could anyone tell me what is wrong with my program,thanx