fork(1) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main() {
  4. //Create an array 40 MB in size.
  5. //Each int is 4 bytes in size.
  6. const int len = 1000*1000*10;
  7. int test[len];
  8. //Fill the array.
  9. for (int i = 0; i < len; i++) {
  10. test[i] = i * 2;
  11. }
  12. //Test the contents of the array.
  13. char valid = 1;
  14. for (int i = 0; i < len; i++) {
  15. if (test[i] != i * 2) {
  16. valid = 0;
  17. break;
  18. }
  19. }
  20. //Display results.
  21. if (valid)
  22. printf("Array created successfully.\n");
  23. else
  24. printf("Failure to create array.\n");
  25. return 0;
  26. }
Success #stdin #stdout 0s 48360KB
stdin
Standard input is empty
stdout
Array created successfully.