fork download
  1. #include<stdio.h>
  2.  
  3. #define SIZE 9
  4.  
  5. void function(int n, int *a, int **b);
  6.  
  7. int main(void)
  8. {
  9. int *b[SIZE];
  10. int a[SIZE] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
  11. function(SIZE, a, b);
  12.  
  13. for (int i = 0; i < SIZE; i++)
  14. {
  15. printf("%d %d %p\n", i, a[i], (void *)b[i]);
  16. }
  17.  
  18. return 0;
  19. }
  20.  
  21. void function(int n, int *a, int **b)
  22. {
  23. for (int i = 0; i < n; i++)
  24. {
  25. b[i] = &a[i];
  26. }
  27. }
  28.  
Success #stdin #stdout 0s 1788KB
stdin
Standard input is empty
stdout
0 1 0xbfc128c4
1 2 0xbfc128c8
2 3 0xbfc128cc
3 4 0xbfc128d0
4 5 0xbfc128d4
5 6 0xbfc128d8
6 7 0xbfc128dc
7 8 0xbfc128e0
8 9 0xbfc128e4