C Programming - Command Line Arguments - Discussion
Discussion Forum : Command Line Arguments - Point Out Correct Statements (Q.No. 2)
2.
Which of the following statements are FALSE about the below code?
int main(int ac, char *av[])
{
}
Discussion:
10 comments Page 1 of 1.
Ron said:
6 years ago
C should be reworded to "MUST be". It is true that it "should" be - various code style guidelines suggest that argc and argv should generally be used in main. Ac and av is misleading since it's not the standard way of doing it, and if I were correcting this code I would tell a person "hey you should change them to argc and argv, everyone uses those. ".
If answer remains C it should be reworded to "MUST" rather than "SHOULD".
If answer remains C it should be reworded to "MUST" rather than "SHOULD".
Pramod said:
6 years ago
Can anyone explain option B?
Arunmane said:
8 years ago
All the options are correct. In option C we can do like that. I did this in GCC Compiler.
Rohitah said:
8 years ago
Answer C is wrong because we can take any variable name at place of argc and argv. This is not compulsory to take variable name argc argv and remaining all options are correct.
Akshay said:
10 years ago
Answer C is not correct for this question. According to Posix standard and other standards for declaring variable names, variable name can be any valid variable name. In this case we can use ac and av instead of argc and argv since these are only variable names for argument counter and argument vectors of command line argument.
Sush said:
1 decade ago
ac and av are just identifiers and so are argc and argv. So there is no constraint that these identifiers "SHOULD BE" argc/argv only!
None said:
1 decade ago
What's the problem with those words use in main as argument ?
Nandu said:
1 decade ago
Ya here all options are correct.opt 3 also right.bcoz actual syntax for command lines z
int main(int argc, char *argv[])
int main(int argc, char *argv[])
Sreejith said:
1 decade ago
All options are true, no false statements. Option c is also right.
Madhu said:
1 decade ago
Can you please explain how answer is C?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers