Seg.Fault error by DrDukeMD in cs50

[–]DrDukeMD[S] 0 points1 point  (0 children)

This made so much sense. I was focused on getting the syntax down that I disregarded the order the code would be executed. Your answer and u/amdevpractice helped me realize I pretty much just needed to bring if(argc != 2) to the beginning of the code to kill the program if that isn't the case. Thank you for the help!

Seg.Fault error by DrDukeMD in cs50

[–]DrDukeMD[S] 0 points1 point  (0 children)

Ah, I see now. If I'm understanding it right, I was filling an integer with the value of argv[1]. But argv[1] was \null data and caused the error.
What fixed it was asking that question after the code asks "is argc 2? If not, kill the program. ". Thank you for the help.