-
What is the output of this program?
#include <iostream>
using namespace std;
struct N
{
int k;
char ch;
float p;
void function();
};
void N :: function() {}
struct M
{
public:
int k;
char ch;
float p;
void function();
};
void M :: function() {}
int main()
{
N obj1; M obj2;
obj1.k = obj2.k = 2;
obj1.ch = obj2.ch = 'U';
obj1.p = obj2.p = 5.125;
obj1.function();
obj2.function();
cout << "Value Allocated in memory...";
return 0;
}
-
- Compilation Error
- Runtime Error
- Value Allocated in memory...
- 2 U 5.125
- None of these
Correct Option: C
In this program, We used access specifiers for structures, As we declared all methods as public, The values can be allocated.