Advertisement
Guest User

Untitled

a guest
May 4th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #include <unistd.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5.  
  6. void function(int ****range)
  7. {
  8.  
  9. *range = malloc(sizeof(***range));
  10. ***range = malloc(sizeof(int) * 5);
  11. printf("%p\n",*range);
  12. int i = 0 ;
  13. while(i < 5)
  14. {
  15. i++ ;
  16. }
  17. i = 0 ;
  18.  
  19. while(i < 5)
  20. {
  21. *(***range + i) = 12 ;
  22. i++ ;
  23. }
  24. }
  25.  
  26. int main(void)
  27. {
  28. int ***tab = NULL ;
  29. function(&tab);
  30. printf("%p",tab);
  31.  
  32. printf("%d\n", *(**tab));
  33. printf("%d\n", *(**tab + 1));
  34. printf("%d\n", *(**tab + 2));
  35. printf("%d\n", *(**tab + 3));
  36. printf("%d\n", *(**tab + 4));
  37. printf("%d\n", *(**tab + 5));
  38.  
  39. free(tab);
  40. tab = NULL ;
  41.  
  42.  
  43. return(0);
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement