分析程序给出下面两段代码的输出结果,并给出具体原因(运行环境基于gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)):
代码一

#include <iostream>
using namespace std;

void foo(const void* ptr)
{
   std::cout << "In foo(void*)" << std::endl;
}

void foo(bool b)
{
   std::cout << "In foo(bool)" << std::endl;
}

void bar()
{
}

int main()
{
   int i = 0;
   foo(&bar);
   foo(&i);
   return 0;
}

代码二

#include <iostream>
using namespace std;

struct C { int m; int n;};
 
int main()
{
    cout << &C::m << endl;
    cout << &C::n << endl;
    return 0;
}

代码一运行结果:

[root c++]#./a.out
In foo(bool)
In foo(void*)

代码二运行结果:

1
1

解答上述结果的回答:
Why does pointer to int convert to void* but pointer to function convert to bool?
Pointers_to_data_members