What happens when you attempt to compile and run the following code?
#include
using namespace std;
class BaseC
{
public:
int *ptr;
BaseC() { ptr = new int(10);}
BaseC(int i) { ptr = new int(i); }
~BaseC() { delete ptr; }
};
void fun(BaseC x);
int main()
{
BaseC *o = new BaseC(5);
fun(*o);
}
void fun(BaseC x) {
cout
What is the output of the program if characters 'h', 'e', 'l', 'l' , 'o' and enter are supplied as input?
#include
#include
using namespace std;
void f();
int main()
{
f();
return 0; }
void f()
{
char c;
c = cin.get();
cout
What happens when you attempt to compile and run the following code?#include using namespace std;void print(char *c);int main (int argc, const char * argv[]){print("Test");return 0;}void print(char *c){cout
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int main()
{
const int x=0;
const int *ptr;
ptr = &x;
cout