#include<stdio.h>
#include<stdlib.h>
struct node {
int data;
struct node *next;
struct node *prev;
};
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->prev=NULL;
head->next=NULL;
}
else{
struct node *temp=head;
struct node *temp2=(struct node *)malloc(sizeof(struct node ));
temp2->data=veri;
while(temp->next!=NULL)
temp=temp->next;
temp->next=temp2;
temp2->prev=temp;
temp2->next=NULL;
}
}
void listele()
{
struct node *temp=head;
while(temp!=NULL)
{
printf("\n%d",temp->data);
temp=temp->next;
}
}
main(){
veriekle();
veriekle();
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