fork download
  1. #include<stdio.h>
  2.  
  3. int builtin_cmd(char **argv);
  4. int main()
  5. {
  6. char *argv[128]; //create an array of c_strings with 128 slots in the array
  7. argv[0] = "quit"; //put 'quit' into argv[0]..
  8. printf("%s\n", argv[0]); //prints 'quit', as it should
  9. builtin_cmd(argv); //call builtin_cmd and pass argv to the function
  10.  
  11. return 0;
  12. }
  13. int builtin_cmd(char **argv)
  14. {
  15. printf("%s\n", argv[0]); //prints nothing, should have printed 'quit'
  16.  
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 2292KB
stdin
Standard input is empty
stdout
quit
quit