fork download
  1. // Type your code here, or load an example.
  2. #include <stdlib.h>
  3.  
  4. char * string_test(int arg);
  5.  
  6. int main()
  7. {
  8. char * test_vals[1000] = {0};
  9. int i = 0;
  10. for (i; i<1000; i++){
  11. test_vals[i] = string_test(i);
  12. }
  13.  
  14. for(i=0; i<1000; i++){
  15. free(test_vals[i]);
  16. }
  17. }
  18.  
  19. char * string_test(int arg){
  20. char * retval = (char*)malloc(sizeof(char*)*arg);
  21. return retval;
  22. }
Success #stdin #stdout 0.01s 5284KB
stdin
1
2
10
42
11
stdout
Standard output is empty