segmentation fault is given whY?Code:struct node {int key;node * next}; node * head,*tmp; head=tmp; for(int i=0;i<nPoints;i++) { tmp=new node; tmp->key=i; tmp=tmp->next; tmp=NULL; } cout<<head->next->key;
segmentation fault is given whY?Code:struct node {int key;node * next}; node * head,*tmp; head=tmp; for(int i=0;i<nPoints;i++) { tmp=new node; tmp->key=i; tmp=tmp->next; tmp=NULL; } cout<<head->next->key;
-mayfda-