C program to find sum of two numbers using command line arguments
In this program, we will provide the input (two integer values) through the command line and program will add them and print the value of input numbers along with the sum of them.
Sample input
./main 10 20
Here, ./main is the program's executable file name, 10 and 20 are the input values.
Sample output
Sum of 10, 20 is: 30
Program to find the sum of two integer numbers using command line arguments in C
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