小白,一段简单的代码,不知道哪里出错了,求大神看一下啊

#include
struct h
{
int b;
}A;
int main()
{
struct *a=&A;

printf("%d",a->b);

}

用C++编译



#include<stdio.h>

struct h
{
    int b;
}A;
int main()
{
    h *a=&A; //修改


    printf("%d",a->b);

}

h是你struct的一个类的名字,所以在你创建新的变量的时候,要用这个变量的类型,也就是h。

struct *a=&A;换成 h *a=&A