fork(1) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. int *integerPower(int y) {
  6. int *ret = malloc(4 * sizeof(int));
  7. ret[0] = pow(y, 2);
  8. ret[1] = pow(y, 3);
  9. ret[2] = pow(y, 4);
  10. ret[3] = ret[0] + ret[1] + ret[2];
  11. return ret;
  12. }
  13. int main(void) {
  14. int *valores = integerPower(5);
  15. printf("%d\n", valores[0]);
  16. printf("%d\n", valores[1]);
  17. printf("%d\n", valores[2]);
  18. printf("%d\n", valores[3]);
  19. free(valores);
  20. }
Success #stdin #stdout 0s 2300KB
stdin
Standard input is empty
stdout
25
125
625
775