Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. struct List {
  5.     int val;
  6.     struct List* next;
  7. };
  8. typedef struct List List;
  9.  
  10. void function2(List* arg) {
  11.     arg->val = 5;
  12.     printf("%d\n", arg->val);
  13.     arg = arg->next;
  14. }
  15.  
  16. void function1(List** arg) {
  17.     (*arg)->val = 5;
  18.     printf("%d\n", (*arg)->val);
  19.     *arg = (*arg)->next;
  20. }
  21.  
  22. int main() {
  23.     List* lista = (List*) malloc(sizeof(struct List));
  24.     lista->next = NULL;
  25.     function1(&lista);
  26.     if (lista == NULL) {
  27.         printf("JEST\n");
  28.     }
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement