怎么结尾会多出来一个‘a’?
源码:
#include <iostream>
using namespace std;
template <class T>
void print(T array[], const int count)
{
int i;
for (i=0; i<count; ++i)
{
cout<<array[i]<<" ";
}
cout<<endl;
}
int main()
{
const int N = 6;
int a[N] = {0,1,2,3,4,5};
char c[N] = "HELLO";
print(a,N);
print(c,N);
return 0;
}
屏幕显示:
0 1 2 3 4 5
H E L L O a
Press any key to continue
???:
HELLO 后面的 'a' 哪来的??