Command Line Arguments
- What will be the output of the following C code (run without any command line arguments)?
#include <stdio.h>
int main(int argc, char *argv[])
{
while (argc--)
printf("%s\n", argv[argc]);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
main
- What will be the output of the following C code (if run with no options or arguments)?
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("%d\n", argc);
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
1
- What is the index of the last argument in command line arguments?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
argc – 1
- A program that has no command line arguments will have argc _________.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
One
- What is argv[0] in command line arguments?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
The name by which the program was invoked