Command Line Argument problem
Hello everyone, I am trying to make an array of size "N" for a school homework assignment involving sorting large arrays. My teacher says to use the command line to get the value n.
I asked about it and they recommended that argv will have the value I want.
my problem is that every time I try to access element 1 of char * argv my program completely crashes.
here's how I'm going about it:
int main(int argc, char * argv)
n = atoi(argv); // this is where it crashes!
Anybody know why this happens and how I can fix it? I can't start my project until I can make an array of size n! Thanks in advance.
¿Did you provide that argument?
hmm... No I didn't do anything like that. How do I go about that if you don't mind explaining?
SO I have to execute my program from the command line to pass in an argument at all?
Topic archived. No new replies allowed.