Facebook
From Walloping Anoa, 6 Years ago, written in C.
This paste is a reply to Untitled from Crippled Prairie Dog - view diff
Embed
Download Paste or View Raw
Hits: 433
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. typedef struct Lista_dwukierunkowa
  5. {
  6.     int dana;
  7.     struct Lista_dwukierunkowa *nast, *poprz;
  8. } Lista;
  9. Lista utworz_element(Lista *element, int dana)
  10. {
  11.     Lista *tmp;
  12.     dana = malloc(sizeof(int));
  13.     tmp = malloc(sizeof(Lista));
  14.     tmp->dana=dana;
  15.     element->nast=NULL;
  16.     element->poprz=tmp;
  17. }
  18. void push_front(Lista *element, int dana)
  19. {
  20.     if(element);
  21.     Lista *tmp;
  22.     utworz_element(tmp, dana);
  23.     element->nast=NULL;
  24.     element->poprz=tmp;
  25. }
  26. void show(Lista *element)
  27. {
  28.     while(element)
  29.     {
  30.         printf("%d ", element->dana);
  31.         element = element->nast;
  32.     }
  33. }
  34. int main()
  35. {
  36.     printf("Hello world!\n");
  37.     Lista *lista;
  38.     lista=NULL;
  39.     push_front(&lista,2);
  40.     push_front(&lista,3);
  41.     show(&lista);
  42.     return 0;
  43. }
  44.  

Replies to Re: Untitled rss

Title Name Language When
Re: Re: Untitled Emerald Crow c 6 Years ago.