Etiket Arşivleri: Bağlı listeler

Bağlı listelerde döngü ve fonksiyon kullanımı

Bağlı listelerde döngü ve fonksiyon kullanımı ile ilgili örnek kod, Şadi Evren ŞEKER’in anlatımından aldım. #include <stdio.h> #include <stdlib.h> typedef struct n{ int x; struct n * next; } node; typedef struct n node; void bastir(node * r){ while(r!=NULL){ printf(“%d\n”,r->x); r=r->next; } } void ekle(node * r,int x){ while(r->next!=NULL){ r=r->next; } r->next=(node *)malloc(sizeof(node)); r->next->x=x; r->next->next=NULL;>>>