What will be the output of the following C++ function?
int main()
{
register int i = 1;
int *ptr = &i;
cout << *ptr;
return 0;
}
a) Runtime error may be possible b) Compiler error may be possible c) 1 d) 0
Answer: b Explanation: 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.