fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int *aloca(int *vetorInt, int tamanho) {
  5. vetorInt = malloc(tamanho * sizeof(int));
  6. if (vetorInt != NULL) printf("*** VETOR ALOCADO.\nENDERECO NA FUNCAO: %d ***\n", vetorInt);
  7. else printf("*** NAO ALOCADO ***\n");
  8. return vetorInt;
  9. }
  10.  
  11. int main (void) {
  12. int *vetor = aloca(vetor, 2);
  13. printf("END. NA MAIN: %d", vetor);
  14. }
  15.  
  16. //https://pt.stackoverflow.com/q/164491/101
Success #stdin #stdout 0s 4288KB
stdin
Standard input is empty
stdout
*** VETOR ALOCADO.
ENDERECO NA FUNCAO: 1315820128 ***
END. NA MAIN: 1315820128