fork download
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3.  
  4. typedef int I2[2];
  5.  
  6. I2 * get_values(void)
  7. {
  8. I2 * x = malloc(sizeof(I2) * 3);
  9.  
  10. x[0][0] = 1;
  11. x[0][1] = 2;
  12.  
  13. x[1][0] = 11;
  14. x[1][1] = 12;
  15.  
  16. x[2][0] = 21;
  17. x[2][1] = 22;
  18.  
  19. return x;
  20. }
  21.  
  22. int main()
  23. {
  24. I2 * x = get_values();
  25.  
  26. int i;
  27. for (i=0; i!=3; i++)
  28. printf("x[%d] = { %d, %d }\n", i, x[i][0], x[i][1]);
  29. }
Success #stdin #stdout 0s 2292KB
stdin
Standard input is empty
stdout
x[0] = { 1, 2 }
x[1] = { 11, 12 }
x[2] = { 21, 22 }