#include<stdio.h>
#include<stdlib.h>
struct node {
int data;
struct node *next;
};
struct node *head;
void veriekle(){
int veri;
printf("bir sayi girin:");
scanf("%d",&veri);
if(head==NULL)
{
head=(struct node *)malloc(sizeof(struct node ));
head->data=veri;
head->next=head;
}
else
{
struct node *temp=head;
struct node *temp2=(struct node *)malloc(sizeof(struct node ));
temp2->data=veri;
while(temp->next!=head)
{
temp=temp->next;
}
temp=temp->next;
temp->next=temp2;
temp2->next=head;
}
}
void listele(){
struct node *temp=head;
do
{
printf("\n%d",temp->data);
temp=temp->next;
}while(temp!=head);
}
main(){
veriekle();
veriekle();
listele();
}
sonraki
« Prev Post
« Prev Post
Önceki
Next Post »
Next Post »
Kaydol:
Kayıt Yorumları (Atom)
Show Conversion Code Hide Conversion Code Show Emoticon Hide Emoticon