fork(1) download
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int x[10]={0,0,0,0,0,0,0,0,0,0};
  5. int *y;
  6. y=x;
  7.  
  8. for(int i=0;i<10;i=i+5)
  9. {
  10. printf("x[%d]の値を入力してください\n",i);
  11. scanf("%d",&*(y+i));
  12. }
  13.  
  14. for(int j=0;j<10;j++)
  15. {
  16. printf("x[%d]:%d\n",j,*(y+j));
  17. }
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 5524KB
stdin
3
2
stdout
x[0]の値を入力してください
x[5]の値を入力してください
x[0]:3
x[1]:0
x[2]:0
x[3]:0
x[4]:0
x[5]:2
x[6]:0
x[7]:0
x[8]:0
x[9]:0