Reputation: 303
The program I am working is passed 3 command line arguments, all of which should be integers. the skeleton program that was provided has:
int main(char *argv[]){
...
}
What I have done the provided is just try to set an integer to the item in each position of the array (0, 1, & 2), but it won't compile since its trying to convert a char to an integer. I'm sure there is an easy fix for this, but I can't seem to figure it out.
Upvotes: 1
Views: 77
Reputation: 726479
Since this looks like homework, I'll give you several of hints:
main()
includes an int
argument, conventionally named argc
argv[1]
, not argv[0]
atoi
is the easiest way to convert a string to an integer.Upvotes: 5