fork(2) download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. char* chooseFileName(void);
  5.  
  6.  
  7. int main()
  8. {
  9. char* file;
  10. file = chooseFileName();
  11. printf("The file '%s' was successfully created\n", file);
  12. }
  13.  
  14. char* chooseFileName()
  15. {
  16. char* filename;
  17. char userInput[30];
  18.  
  19. puts("enter the filename:");
  20. scanf("%s", userInput);
  21. printf("Before ass. : %s\n", userInput);
  22. filename = userInput;
  23. printf("After ass. :%s\n", filename);
  24. return filename;
  25. }
  26.  
  27.  
Runtime error #stdin #stdout 0s 2012KB
stdin
11
stdout
enter the filename:
Before ass. : 11
After ass. :11
The filename 'y�L����r���/' was successfully created