#include<stdio.h>
#define SIZE 9
void function(int n, int *a, int **b);
int main(void)
{
int *b[SIZE];
int a[SIZE] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
function(SIZE, a, b);
for (int i = 0; i < SIZE; i++)
{
printf("%d %d %p\n", i
, a
[i
], (void *)b
[i
]); }
return 0;
}
void function(int n, int *a, int **b)
{
for (int i = 0; i < n; i++)
{
b[i] = &a[i];
}
}
I2luY2x1ZGU8c3RkaW8uaD4KCiNkZWZpbmUgU0laRSA5Cgp2b2lkIGZ1bmN0aW9uKGludCBuLCBpbnQgKmEsIGludCAqKmIpOwoKaW50IG1haW4odm9pZCkKewogICAgaW50ICpiW1NJWkVdOwogICAgaW50IGFbU0laRV0gPSB7MSwgMiwgMywgNCwgNSwgNiwgNywgOCwgOX07CiAgICBmdW5jdGlvbihTSVpFLCBhLCBiKTsKCiAgICBmb3IgKGludCBpID0gMDsgaSA8IFNJWkU7IGkrKykKICAgIHsKICAgICAgICBwcmludGYoIiVkICVkICVwXG4iLCBpLCBhW2ldLCAodm9pZCAqKWJbaV0pOwogICAgfQogICAgCiAgICByZXR1cm4gMDsKfQoKdm9pZCBmdW5jdGlvbihpbnQgbiwgaW50ICphLCBpbnQgKipiKQp7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykKICAgIHsKICAgICAgICBiW2ldID0gJmFbaV07CiAgICB9Cn0K