Code: #include<stdio.h> #include<string.h> #include<malloc.h> struct node { char *data; struct node *next; }; typedef struct node *Node; struct stack { Node head; }; typedef struct stack *Stack; Node createNode(char *data) { Node newnode; newnode=(Node)malloc(sizeof(Node)); newnode->data=data; newnode->next=NULL; return newnode; } void push(Stack s,char *str) { Node newnode; newnode=createNode(str); if(!newnode) { printf("Memory exhausted\n"); return; } newnode->next=s->head; s->head=newnode; } int main() { Stack s; char *str; s->head=NULL; push(s,"hai"); return 0; } Actually its a part of stack implimentaion.Dudes.... when i try to initilise the head to NULL as in the main() or if i try to assign it to some other reference as in the push module its giving me segmentation fault.I dont know wats happening here can anyone cud kindly explain why this program went wrong.Iam really confused ill be greatful if u ppl help me.......sorry for the long post.....thanks in advance.....