直接通过取地址符 & 进行获取。
例如 :
struct Student
{
char Name[10];
int Age;
char Sex;
}
Student stu;
&stu.Age // 获取 Age 的地址
直接ss.a 就可以使用a并且对其赋值啦。 如果非要追究地址的话加上地址符“&”
#include
typedef struct
{
int a;
int b;
}stu;
void main()
{
stu ss;
ss.a = 10;
ss.b = 15;
printf("a[%d] && b[%d]\n",ss.a,ss.b);
}
PStudent; begin New(PStudent1); ShowMessage(IntToStr(Integer(@PStudent1^.Name))); //取结构体指针成员变量Name的地址 Dispose(PStudent1); end;
&ss.a试试看