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