fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main (){
  4. int *x = malloc(3*sizeof(int)) ;
  5. printf("%d\n",*(x+0)) ;
  6. printf("%d\n",*(x+1)) ;
  7. printf("%d\n",*(x+2)) ;
  8. *(x+0)=1;
  9. *(x+1) =3;
  10. *(x+2) =3;
  11. printf("%d\n",*(x+0)) ;
  12. printf("%d\n",* (x+1) ) ;
  13. printf("%d\n",*(x+2) ) ;
  14. int *y = calloc(3, sizeof (int)) ;
  15. printf("%d\n",*(y+0)) ;
  16. printf("%d\n",*(y+1)) ;
  17. printf("%d\n",*(y+2) ) ;
  18. *(y+0)=1;
  19. *(y+1)=3;
  20. *(y+2) =3;
  21. printf("%d\n",*(y+0) ) ;
  22. printf("%d\n",*(y+1));
  23. printf("%d\n",*(y+2) ) ;
  24. }
  25.  
  26.  
Success #stdin #stdout 0s 544KB
stdin
Standard input is empty
stdout
0
0
0
1
3
3
0
0
0
1
3
3