版主强!一语中的,我运行了一下:
#include<iostream.h>
void main()
{
int a=100;
char m_choice;
char c[2]={'a','\0'};
int *pa;
char *pc;
pa=&a;
pc=&c[0];
cout<<"pa="<<pa<<", *pa="<<*pa<<endl;
cout<<"pc="<<(int *)pc<<", *pc="<<*pc<<endl;
while(m_choice!='Q')
{
cout<<"退出请选择'Q':"; cin>>m_choice;
}
}
结果:pa=0x0012FF7C,*pa=100
pc=0x0012FF74,*pc=a
实际int,char都是字节类型:
#include<iostream.h>
void main()
{
int a=100;
char m_choice;
int c='a';
int *pa;
int *pc;
pa=&a;
pc=&c;
cout<<"pa="<<pa<<", *pa="<<*pa<<endl;
cout<<"pc="<<pc<<", *pc="<<(char)*pc<<endl;
while(m_choice!='Q')
{
cout<<"退出请选择'Q':"; cin>>m_choice;
}
}
运行结果一样。。。
问一下高手,VC6.0 MFC程序中可以定义BYTE a;
在上面为什么不能这样定义?需要什么头文件?