C program to calculate addition, subtraction, multiplication using command line arguments
In this program, we will pass three arguments with the program's executable file name like (./main 10 + 20), program will calculate the result according to input operator. In this program allowed operators are +, -, and *, you can add other cases perform the calculations.
Sample Input:
./main 10 + 20
Sample Output:
Result: 10 + 20 = 30
Output
What is atoi()?
atoi() is a library function that converts string to integer, when program gets the input from command line, string values transfer in the program, we have to convert them to integers (in this program). atoi() is used to return the integer of the string arguments.
need an explanation for this answer? contact us directly to get an explanation for this answer