C Function Argc,Argv
Question # 00798815
Posted By:
Updated on: 03/19/2021 11:04 AM Due on: 04/08/2021

For ODP412, you need to write a C function named start. The prototype is:
int start(int argc, char **argv);
The function accepts an argc and argv similar to what is typically passed to main.
The return value is as follows:
- if argc != 2 (not equal to 2), return -1
- if argc==2, then return the following:
- if argv[1] is not an integer, return -2
- if argv[1] is an integer but is not positive, return -3
- otherwise argv[1] is a positive integer: return its value
You must use sscanf (as usual). Be sure to check the return value from sscanf
to determine whether or not its argument represents an integer.
Write your own main test function to test your start function.

-
Rating:
5/