Take the following code:
#include <stdlib.h>
int main(int argc, char **argv, char **envp)
{
int sum;
atoi(&argv[1]);//statement with no effect. Passing argument 1 of ‘atoi’ from incompatible pointer type
atoi(&argv[2]);//statement with no effect. Passing argument 1 of ‘atoi’ from incompatible pointer type
sum = argv[1]+argv[2]; //error: invalid operands to binary +
return sum;
}
On the lines with atoi(&argv[integer]) give me two warnings, statement with no effect, and passing argument 1 from atoi incompatible pointer type.
the line where I try to place the two argv members into a single integer by using addition gives me the error "invalid operands to binary".
Can anyone please explain to me why the comipler gives me this error and those four warnings? Thank-you.