As we say we have to access an element in linked list sequentially. Then what is this:
cout<<"Enter size of linked list : ";
int n;
cin>>n;
node *ll[n];
cout<<endl<<"enter elements : ";
for(int i=0;i<n;i++)
{
ll[i]=new node();
ll[i]->next=NULL;
cin>>ll[i]->data;
}
for(int i=0;i<n-1;i++)
{
ll[i]->next=ll[i+1];
}
cout<<endl<<ll[1]->data;
cout<<endl<<ll[1]->data;
I can access a random element with this line, right?