Discussion
Which is the correct form to declare main with command line arguments ?
Answer: B
Correct answer: int main(int argc, char* argv[]){ }
This is the conventional form: an int count followed by an array of char *, each pointing at one argument string.
char **argv is exactly equivalent, since an array parameter decays to a pointer to its first element - the third option is therefore also correct in practice, and only one answer being expected here, the array notation is the canonical spelling. char argv[] would be an array of single characters, and int *argc a pointer where a count is wanted.
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