What is the use of main function in c++?


No Answer is Posted For this Question
Be the First to Post Answer

Post New Answer

More C++ General Interview Questions

What is the difference between an external iterator and an internal iterator? Describe an advantage of an external iterator?

0 Answers  


What is difference between c++ and c ++ 14?

0 Answers  


What is decltype c++?

0 Answers  


What are Binay tress and B trees? Diff between them?

8 Answers   CTS, GATE, Wipro,


Ask to write virtual base class code?

0 Answers   Satyam,






Why is it necessary to use a reference in the argument to the copy constructor?

0 Answers  


Find out the bug in this code,because of that this code will not compile....... #include <iostream> #include <new> #include <cstring> using namespace std; class balance { double cur_bal; char name[80]; public: balance(double n, char *s) { cur_bal = n; strcpy(name, s); } ~balance() { cout << "Destructing "; cout << name << "\n"; } void set(double n, char *s) { cur_bal = n; strcpy(name, s); } void get_bal(double &n, char *s) { n = cur_bal; strcpy(s, name); } }; int main() { balance *p; char s[80]; double n; int i; try { p = new balance [3]; // allocate entire array } catch (bad_alloc xa) { cout << "Allocation Failure\n"; return 1; }

2 Answers   Impetus,


In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest.

5 Answers   GE,


What is friend class in c++ with example?

0 Answers  


What is difference between c++ 11 and c++ 14?

0 Answers  


What is fflush c++?

0 Answers  


What is the type of 'this' pointer?

0 Answers  


Categories