Discussion
Which of the following statements are FALSE about the below code?
int main(int ac, char *av[])
{
}
Answer: C
Correct answer: In place of ac and av, argc and argv should be used.
That is the false statement. The names are conventional, not required: the compiler cares only that the first parameter is an int and the second a char **, so ac and av work exactly as well.
The other three are true. ac holds the count of arguments including the program name, av[] holds their addresses, and both are ordinary parameters of main and therefore local to it - which is why passing them on to other functions, or copying them into globals, is necessary.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development