-
What will be output of this function?
#include
using namespace std;
int main()
{
register int p = 15;
int *ptr = &p;
cout << *ptr;
return 0;
}
-
- Compilation Error
- Runtime Error
- 15
- 10
- None of these
Correct Option: C
Using & on a register variable may be invalid, since the compiler may store the variable in a register, and finding the address of it is illegal.