1

when we create a pointer 'int (*ptr)()' and assign it to a function 'foo', it should store the address of that function. But when i try to print the pointer ptr it displays 1 instead of the address of the foo. Why is that ?

#include <iostream>

int foo(){
    return 2019;
}

int main(){

    int (*ptr)() = foo;

    std::cout << ptr << std::endl;

}
user123456789
  • 424
  • 4
  • 15

0 Answers0