[Solved] Why does my program crash if I don’t give command line arguments to it? [closed]
It crashes because you are accessing argv[1] which would hold a command line argument (other than the program’s name) if there was one. You should check whether argc is greater than 1. Why greater than 1? Because the first command line argument is the name of the program itself. So argc is always greater than … Read more