#include <stdio.h>
#include <stdlib.h>
int *aloca(int *vetorInt, int tamanho) {
vetorInt
= malloc(tamanho
* sizeof(int)); if (vetorInt != NULL) {
printf("*** VETOR ALOCADO.\nENDERECO NA FUNCAO: %d ***\n", vetorInt
); } else {
printf("*** NAO ALOCADO ***\n"); }
return vetorInt;
}
int main (void) {
int *vetor = aloca(vetor, 2);
printf("END. NA MAIN: %d", vetor
); }
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCmludCAqYWxvY2EoaW50ICp2ZXRvckludCwgaW50IHRhbWFuaG8pIHsKCXZldG9ySW50ID0gbWFsbG9jKHRhbWFuaG8gKiBzaXplb2YoaW50KSk7CiAgICBpZiAodmV0b3JJbnQgIT0gTlVMTCkgewogICAgICAgIHByaW50ZigiKioqIFZFVE9SIEFMT0NBRE8uXG5FTkRFUkVDTyBOQSBGVU5DQU86ICVkICoqKlxuIiwgdmV0b3JJbnQpOwogICAgfSBlbHNlIHsKICAgICAgICBwcmludGYoIioqKiBOQU8gQUxPQ0FETyAqKipcbiIpOwogICAgfQogICAgcmV0dXJuIHZldG9ySW50Owp9CgppbnQgbWFpbiAodm9pZCkgewogICAgaW50ICp2ZXRvciA9IGFsb2NhKHZldG9yLCAyKTsKICAgIHByaW50ZigiRU5ELiBOQSBNQUlOOiAlZCIsIHZldG9yKTsKfQoK