fork(1) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(void) {
  5. double* a;
  6. a = (double*)malloc(sizeof(double)*5);
  7. // ここまでで、double型の配列(長さ5)ができた。
  8. for(int i=0;i<5;i++){
  9. a[i]=i/10;
  10.  
  11. printf("a[i]のアドレスは %p\n",&(a[i]));
  12. printf("その中身は %lf\n",a[i]);
  13.  
  14. }
  15.  
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
a[i]のアドレスは 0x556d05484260
その中身は 0.000000
a[i]のアドレスは 0x556d05484268
その中身は 0.000000
a[i]のアドレスは 0x556d05484270
その中身は 0.000000
a[i]のアドレスは 0x556d05484278
その中身は 0.000000
a[i]のアドレスは 0x556d05484280
その中身は 0.000000