小编Sat*_*nan的帖子

为什么不允许在其元素中使用结构变量本身?

为什么不允许声明具有自己的标识符的结构作为其元素?作为一个自引用结构,由结构的同一个变量用指针符号声明!

这是我试过的代码:

 #include<stdio.h>
    #include<conio.h>
    struct am
    {
     int a;
     struct am k; // this reported an error
    };
Run Code Online (Sandbox Code Playgroud)

这段代码报告了一个错误,当我用它作为指针接受它时,我搜索了网络,我开始知道它被称为自引用结构

#include<stdio.h>
    #include<conio.h>
    struct ko
    {
     int a;
     struct ko * op; // this was allowed by my compiler
    };
Run Code Online (Sandbox Code Playgroud)

这个结构工作请告诉我!

我正在使用borland international inc的TurboC++ 3.0版.

c c++ struct

-3
推荐指数
1
解决办法
111
查看次数

标签 统计

c ×1

c++ ×1

struct ×1