C与C++在char上的不同.
程序1:
#include <stdio.h>
int main()
{
printf("%d\n",sizeof('A'));
printf("%d\n",sizeof(char));
printf("%d\n",sizeof(65));
return 0;
}
结果:
程序2:
#include <iostream>
using namespace std;
int main()
{
cout<<sizeof('A')<<endl;
cout<<sizeof(char)<<endl;
cout<<sizeof(65)<<endl;
return 0;
}
using namespace std;
int main()
{
cout<<sizeof('A')<<endl;
cout<<sizeof(char)<<endl;
cout<<sizeof(65)<<endl;
return 0;
}