I have the following code to run on the terminal. It checks if the first argument is a '+' and then adds the next numbers.
int main(int argc, char *argv[])
{
int i, soma;
char oper;
oper = *argv[1];
soma = 0;
if(oper == '+'){
for(i = 2; i <= argc; i++){
soma = soma + atoi(argv[i]);
}
printf("Soma: %d", soma);
}
The question is why
oper = *argv[1]
needs the pointer while
atoi(argv[i])
do not need