fork(1) 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) {
  7. printf("*** VETOR ALOCADO.\nENDERECO NA FUNCAO: %d ***\n", vetorInt);
  8. } else {
  9. printf("*** NAO ALOCADO ***\n");
  10. }
  11. return vetorInt;
  12. }
  13.  
  14. int main (void) {
  15. int *vetor = aloca(vetor, 2);
  16. printf("END. NA MAIN: %d", vetor);
  17. }
  18.  
  19.  
Success #stdin #stdout 0s 2300KB
stdin
Standard input is empty
stdout
*** VETOR ALOCADO.
ENDERECO NA FUNCAO: 143048712 ***
END. NA MAIN: 143048712