Advertisement
PaweU

asfaaaa

Dec 11th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. struct student {
  5. char nazwisko [40];
  6. int nr;
  7. struct student *p;
  8. };
  9.  
  10. void wypisz (struct student *wskaznik) {
  11. printf ("\n\n\n");
  12. while (wskaznik != NULL) {
  13. printf ("%s%d\n", wskaznik->nazwisko, wskaznik->nr);
  14. wskaznik = wskaznik->p;
  15. };
  16. };
  17.  
  18.  
  19. int main (void) {
  20.  
  21.  
  22.  
  23. struct student *head = NULL;
  24.  
  25.  
  26. struct student *tmp = (struct student *)malloc (sizeof (struct student));
  27. fgets (tmp->nazwisko, 40, stdin);
  28. scanf ("%d", &tmp->nr);
  29. tmp->p = NULL;
  30. head = tmp;
  31.  
  32.  
  33. wypisz (head);
  34.  
  35.  
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement