link list in cpp


//implementation of link list in cpp
#include<iostream.h>
#include<conio.h>
void main()
{
typedef struct node
{
int data;
struct node *link;
}NODE;
NODE *ptr,*start,*prev;
int i;
clrscr();
start=NULL;
cout<<"\nEnter 10 elements in array\n";
for(i=0;i<10;i++)
{
ptr=new NODE();
cin>>ptr->data;
ptr->link=NULL;
if(start==NULL)
{
start=ptr;
}
else
{
prev->link=ptr;
}
prev=ptr;
}
ptr=start;
cout<<"\nElements in array\n";
for(i=0;i<10;i++,ptr=ptr->link)
cout<<"\na["<<i<<"]="<<ptr->data;
getch();
}
*******output********






No comments:

Post a Comment

using avrdude with AVR studio(for windows 10 only)

Requirements 1. arduino-1.6.5-r2-windows.exe 2. as6installer-6.0.1843.exe When I try to configure avrdude in avr studio 6 then wina...