Home » C++ Programming » Data Types » Question
  1. What will be output of this function?
    #include 
    using namespace std;
    int main()
    {
    register int p = 15;
    int *ptr = &p;
    cout << *ptr;
    return 0;
    }
    1. Compilation Error
    2. Runtime Error
    3. 15
    4. 10
    5. 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.



Your comments will be displayed only after manual approval.