The index of the last argument in command line arguments is
Answers
Answered by
0
Answer:
argc – 1
Explanation:
- In C, we send arguments to main function. The arguments that we send to main ( ) at the invocation of command prompt are called command line arguments. These arguments are supplied when the program is called for.
- The main ( ) function will take argument:
main (int argc, char *argv[]) { }
- The argc of the first argument is called 'argument counter'. It shows how many counters are there in command line. And, the second argument or the second command line is known as argv is acknnowledged as 'argument vector'.
Answered by
0
Answer:
The index of the last argument in command line arguments is N-1
Explanation:
Array index starts always with 0 in most of the programming language. Even during iteration process to fetch any array value, the iteration starts with 0 and ends at n-1.
Eg. if the array can accept 10 values then the index starts from 0 and ends with 9 (n-1--> 10 – 1 = 9). So, this rule is same for command line arguments. So the last argument would be arg-1 or n-1.
Similar questions