#include <stdio.h>
#include <stdlib.h>
#define N 100
void function(int n, int *a, int ***b)
{
int i;
if ((*b
= (int **)malloc(sizeof(int **) * n
)) == NULL
)
for (i = 0; i < N; i++)
(*b)[i] = &a[i];
}
int main(void)
{
int *a
= (int *)malloc(sizeof(int) * N
), **b
; int i;
if (a == NULL)
for (i = 0; i < N; i++)
a[i] = i * 2;
function(N, a, &b);
for (i = 0; i < N; i++)
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCiNkZWZpbmUgTiAxMDAKCnZvaWQgZnVuY3Rpb24oaW50IG4sIGludCAqYSwgaW50ICoqKmIpCnsKICBpbnQgaTsKICAKICBpZiAoKCpiID0gKGludCAqKiltYWxsb2Moc2l6ZW9mKGludCAqKikgKiBuKSkgPT0gTlVMTCkKICAgIGV4aXQoMSk7CiAgCiAgZm9yIChpID0gMDsgaSA8IE47IGkrKykKICAgICgqYilbaV0gPSAmYVtpXTsKfQoKaW50IG1haW4odm9pZCkKewogIGludCAqYSA9IChpbnQgKiltYWxsb2Moc2l6ZW9mKGludCkgKiBOKSwgKipiOwogIGludCBpOwoKICBpZiAoYSA9PSBOVUxMKQogICAgZXhpdCgxKTsKCiAgZm9yIChpID0gMDsgaSA8IE47IGkrKykKICAgIGFbaV0gPSBpICogMjsKICAKICBmdW5jdGlvbihOLCBhLCAmYik7CiAgCiAgZm9yIChpID0gMDsgaSA8IE47IGkrKykKICAgIHByaW50ZigiJWQgIiwgKmJbaV0pOwogIHB1dGNoYXIoJ1xuJyk7CiAgCiAgcmV0dXJuIDA7Cn0=