C Programming - Command Line Arguments
Exercise "When ambition ends, happiness begins."
- (Proverb)
1.
In Turbo C/C++ under DOS if we want that any wild card characters in the command-line arguments should be appropriately expanded, are we required to make any special provision?
Answer: Option D
Explanation:
Yes you have to compile a program liketcc myprog wildargs.obj
2.
If the different command line arguments are supplied at different times would the output of the following program change?
#include<stdio.h>
int main(int argc, char **argv)
{
printf("%d\n", argv[argc]);
return 0;
}
Answer: Option E
Explanation:
No answer description available for this question. Let us discuss .
3.
Does there exist any way to make the command-line arguments available to other functions without passing them as arguments to the function?
Answer: Option E
Explanation:
Using the predefined variables _argc, _argv . This is a compiler dependent feature. It works in TC/TC++ but not in gcc and visual studio.