遇到问题:用另一个指针除指针的sizeof值
程序代码:
#include "mp.h" void maopao(int mp[]) { int a = (sizeof(mp) / sizeof(mp[0])); cout << "冒泡前的数列" << endl; for (int num0 = 0; num0 < a; num0++) { cout << mp[num0] << " "; } cout << endl; for (int j = 0; j < a - 1; j++) { for (int i = 0; i < a - j - 1; i++) { if (mp[i] > mp[i + 1]) { int temp = mp[i]; mp[i] = mp[i + 1]; mp[i + 1] = temp; } } } cout << "冒泡后的数列:" << endl; for (int num = 0; num < a; num++) { cout << mp[num] << " "; } cout << endl; }
大佬们,这个函数中第三行警告用另一个值除指针的sizeof值,是怎么回事?