Home » C++ Programming » Pointers » Question
  1. What is the output of this program?
    #include 
    using namespace std;
    int main()
    {
    int num;
    char ch;
    void *value;
    num = 5;
    ch = 'd';
    value = #
    cout << "The value points to the integer value " << value << endl;
    value = &ch;
    cout << "The value now points to the character " << value;
    return 0;
    }
    1. The value points to the integer value 0x7c9edb4e77ec
    2. The value now points to the character 0x7c9edb4e77eb
    3. Compilation Error
    4. The value points to the integer value 0x7c9edb4e77ec
      The value now points to the character 0x7c9edb4e77eb
    5. 5
Correct Option: D

Because the data points to the address value of the variables only, So it is printing the memory address of these two variable.



Your comments will be displayed only after manual approval.