fork 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. for(int i=0; i<5; i++){
  8. a[i] = (double)i/10;
  9. }
  10. for(int i=0; i<5; i++){
  11. printf("a[%d]のアドレスは%pです。\n",i,&(a[i]));
  12. printf("%lf\n",a[i]);
  13. }
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0.01s 5308KB
stdin
Standard input is empty
stdout
a[0]のアドレスは0x55ce583e0260です。
0.000000
a[1]のアドレスは0x55ce583e0268です。
0.100000
a[2]のアドレスは0x55ce583e0270です。
0.200000
a[3]のアドレスは0x55ce583e0278です。
0.300000
a[4]のアドレスは0x55ce583e0280です。
0.400000