My code is "calling" a function without (), and printing the result with std::cout
. The function compiles and surprisingly, the code always returns 1.
I expected a function pointer to be printed instead of the 1s. Why is this happening? Did I get all 1's only by chance?
#include <iostream>
using namespace std;
void pr ()
{
cout << "sth";
}
int main()
{
pr;
cout << pr; // output: 1
cout << *pr; // output: 1
cout << ≺ // output: 1
}
:P
– Concuss