cout 输出字符串数组和其他数组时的问题

时间:2023-01-03 10:57:36
#include <iostream>
using namespace std;

int main()
{
//int a[5]={1,2,34,4,5}; //如果不是char型,cout<<"a="<<a<<endl;输出的为int数组首地址。不会输出数组中的值。
char a[5]="aaaa"; //cout重载了char[],可以输出整个字符串数组
cout<<"a="<<a<<endl;
return 0;
}





相关文章