Facebook
From Silly Teal, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 265
  1. #include <stdio.h>
  2. #include <conio.h>
  3.  
  4. typedef struct list{
  5.         int d;
  6.         struct list *next;
  7. }list;
  8. list *head;
  9.  
  10. void wypisz(){
  11.         while(head!=NULL){
  12.                 printf("%i\n", head->d);
  13.                 head=head->next;
  14.         }
  15. }
  16.  
  17. int main(){
  18.         int i;
  19.         for(i=0; i<4; i++){
  20.                 list* nowy=(list*)malloc(sizeof(list));
  21.                 nowy->d=2+1;
  22.                 if(i==0)
  23.                         {nowy->next=NULL;}
  24.                 else
  25.                         {nowy->next=head;}
  26.                         head=nowy;
  27.         }
  28.         wypisz();
  29.         return 0;
  30. }