fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(void) {
  5. int i,n,*a;
  6. scanf("%d",&n);
  7. a=(int*)malloc(sizeof(int*)*n);
  8. for (i=0;i<n;i++){
  9. a[i]=i;
  10. printf("%3d\n",a[i]);
  11.  
  12. }
  13. free(a);
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 5272KB
stdin
5
stdout
  0
  1
  2
  3
  4