#include<iostream>
using namespace std;
struct node{
int data; // for data component
node* next; // to hold addr of next
}*head_first=NULL;
void create(int* a, int n) // a is array and n is sizeof
{
node *newnode,*temp;
newnode=new node();
for(int i=0;i<n;i++){
newnode->data=a[i];
newnode->next=NULL;
if(head_first==NULL){
temp=head_first=newnode;
cout<<"head assigned"<<endl;
}
else{
temp->next=newnode;
temp=newnode;
cout<<i<<" node created"<<endl;
}
}
}
void dis(node *p){
while(p!=NULL){
cout<< p->data <<endl;
p=p->next;
}
}
int main(){
int a[]={10,20,30,40,50,60};
int size=sizeof(a)/sizeof(int);
create(a,size);
dis(head_first);
return 0;
}