我有以下代码:如何访问结构成员与结构指针
#include <stdio.h>
#include <stdlib.h>
#include<string.h>
struct tag
{
int x;
};
int main()
{
struct tag stvar;
struct tag*stptr=&stvar;
*(stptr).x=9;
return 0;
}
我可以使用stptr->x
但不*(stptr).x
。我越来越 request for member 'x' in 'stptr', which is of pointer type 'tag*' (maybe you meant to use '->' ?)
我在哪里错了?如何使用结构指针访问成员?