Cisco Systems Interview Question
368 Interview Reviews |
Back to all Cisco Systems Interview Questions & Reviews
Interview questions and reviews posted anonymously by interview candidates
Interview Question for Software Engineering Intern at Cisco Systems:
How would you implement a singly-linked list in C?
See more for this Cisco Systems Software Engineering Intern Interview
Helpful Question?
Yes |
No
Inappropriate?



0 of 0 people found this helpful
by Shishir:
#include <conio.h>
using namespace std;
struct link
{
int data;
link* next;
};
class linklist
{
private:
link* first;
public:
linklist()
{
first=NULL;
}
void additem(int d)
{
link* newlink=new link;
newlink->data=d;
newlink->next=first;
first=newlink;
}
void display()
{
link* current=first;
while(current!=NULL)
{
cout<<current->data<<endl;
current=current->next;
}
}
};
int main()
{
linklist li;
li.additem(25);
li.additem(36);
li.additem(49);
li.additem(64);
li.display();
getch();
return 0;
}