Quote (spt_94 @ 12 Mar 2016 22:11)
I am not that experienced with c/c++. Thought the way I was thinking was right.
Would what I have be correct if all indexes were +1?
I am not sure how you match the -r -c -m with the numbers unless the argv was storing arrays like argv[1] = array{'r',10}
argc is just the number of arguments, not an array, so in your example:
./minesweeper -r 10 -c 10 -m 20
argc[0] -> 10 ; argc[1] -> 10 ; argc[2] -> 20
becomesargc = 3
argv[0] -> 'r' ; argv[1] -> 'c' ; argv[2] -> 'm'
becomesargv[0] = (some black magic) ; argv[1] = -r 10 ; argv[2] = -c 10 ; argv[3] = -m 20 (if we ignore the whitespace)
This post was edited by Klexmoo on Mar 12 2016 03:28pm