#include<iostream>
using namespace std;
struct anik
{
int data;
struct anik *next;
};
void printl(anik *head)
{
anik *ptr = head ->next;
while(ptr != NULL)
{
cout << ptr->data << " ";
ptr = ptr->next;
}
}
int main()
{
struct anik *head = NULL;
struct anik *second = NULL;
struct anik *third = NULL;
struct anik *four = NULL;
head = (struct anik*) malloc(sizeof(struct anik));
second = (struct anik*) malloc(sizeof(struct anik));
third = (struct anik*) malloc(sizeof(struct anik));
four = (struct anik*) malloc(sizeof(struct anik));
head->data = 1;
head->next = second;
second->data = 2;
second->next = third;
third->data = 3;
third->next = four;
four->data = 4;
four->next = NULL;
printl(head);
return 0;
}
using namespace std;
struct anik
{
int data;
struct anik *next;
};
void printl(anik *head)
{
anik *ptr = head ->next;
while(ptr != NULL)
{
cout << ptr->data << " ";
ptr = ptr->next;
}
}
int main()
{
struct anik *head = NULL;
struct anik *second = NULL;
struct anik *third = NULL;
struct anik *four = NULL;
head = (struct anik*) malloc(sizeof(struct anik));
second = (struct anik*) malloc(sizeof(struct anik));
third = (struct anik*) malloc(sizeof(struct anik));
four = (struct anik*) malloc(sizeof(struct anik));
head->data = 1;
head->next = second;
second->data = 2;
second->next = third;
third->data = 3;
third->next = four;
four->data = 4;
four->next = NULL;
printl(head);
return 0;
}
Comments
Post a Comment