In the following declaration of main, "int main(int argc,
char *argv[])", to what does argv[0] usually correspond?




1) The first argument passed into the program


2) The program name


3) You can't define main like that

Answer Posted / vadivel

If the value of argc is greater than 0, the array members
argv[0] through argv[argc-1] inclusive shall contain
pointers to strings, which will be the command line
arguments. argv[0] will contain the program name, argv[1]
the first command line arg, argv[1] the second and so on.
Finally, argv[argc] is guaranteed to the a NULL pointer,
which can be useful when looping through the array.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the advantages of polymorphism?

671


What is encapsulation in oops?

634


How do you define social class?

682


Why multiple inheritance is not possible?

683


What is overriding in oop?

653






What is interface? When and where is it used?

1757


What is the significance of classes in oop?

679


What is an interface in oop?

675


Why do we use oops?

673


What do you mean by abstraction?

696


Can a varargs method be overloaded?

704


Question: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date.

761


What does <> mean pseudocode?

715


What exactly is polymorphism?

693


There are two base class B1,B2 and there is one class D which is derived from both classes, Explain the flow of calling constructors and destructors when an object of derived class is instantiated.

1558