fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(void) {
  5. double* a;
  6. a = (double*)malloc(sizeof(double)*4);
  7. // ここまでで、int型の配列(長さ4)ができた。
  8. a[0]=1/10;
  9. a[1]=1;
  10. a[2]=2;
  11. a[3]=3;
  12.  
  13. printf("その中身は %f\n",a[0]);
  14.  
  15.  
  16. printf("その中身は %f\n",a[1]);
  17.  
  18.  
  19. printf("その中身は %f\n",a[2]);
  20.  
  21.  
  22. printf("その中身は %f\n",a[3]);
  23.  
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
その中身は 0.000000
その中身は 1.000000
その中身は 2.000000
その中身は 3.000000