供对照参考:
#include<iostream>
using namespace std;
void show(const int* begin, const int* end)
{
for (const int* ptr = begin; ptr < end; ptr++)
{
if (ptr == begin)
cout << *ptr;
else
cout << "," << *ptr;
}
}
int main()
{
int value[5] = { 1,2,3,4,5 };
show(value, value + 5);
return 0;
}
main写成面了
判断语句写成赋值语句了
1.第5行,ptr=end应该是ptr!=end
2.main函数返回值是int类型,需要在main函数最后加一句:return 0;