为什么C++编译没有错误,但是调试的时候不对
(2)#include<iostream>usingnamespacestd;intmain(){chara[]="abc";char*b="ABC";cout<<siz...
(2)
#include <iostream>
using namespace std;
int main()
{
char a[] = "abc";
char *b = "ABC";
cout << sizeof(a) <<endl;
cout << sizeof(b) <<endl;
a[0] = 'A';
b[0] = 'x';
cout << a << '\t' << (int)a << endl;
cout << b << '\t' << (int)b << endl;
cout << &a << '\t' << (int)&a << endl;
cout << &b << '\t' << (int)&b << endl;
cout << *a << '\t' << (int)*a << endl;
cout << *b << '\t' << (int)*b << endl;
return 0;
} 展开
#include <iostream>
using namespace std;
int main()
{
char a[] = "abc";
char *b = "ABC";
cout << sizeof(a) <<endl;
cout << sizeof(b) <<endl;
a[0] = 'A';
b[0] = 'x';
cout << a << '\t' << (int)a << endl;
cout << b << '\t' << (int)b << endl;
cout << &a << '\t' << (int)&a << endl;
cout << &b << '\t' << (int)&b << endl;
cout << *a << '\t' << (int)*a << endl;
cout << *b << '\t' << (int)*b << endl;
return 0;
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询