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.
Since this looks like homework, I’ll give you several of hints:
main()includes anintargument, conventionally namedargcargv[1], notargv[0]atoiis the easiest way to convert a string to an integer.