检查一个元素是否在C结构内部存在 [英] Check whether an element exist inside a structure in C

查看:101
本文介绍了检查一个元素是否在C结构内部存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个结构说苹果,那么,有没有办法来检查特定元素是否说色里面的结构存在?

If i have a structure say "apple", so is there a way to check whether a particular element say "color" exist inside the structure?

struct apple A{
char color;
int pack;
}

使用这种可知道这种结构比它的名字......

The function which uses this may be knowing the internals of this structure other than its name.....

推荐答案

C不支持你所追求的 - 在需要它,它听起来像什么是错的与您的设计。如果是除pretting流那么应该有与标识符早上indicateds后面的流中的结构的信息流中。

C does not support what you are after - and in requiring it it sounds like something is wrong with your design. If you are interpretting a stream then there should be and identifier early on in the stream that indicateds the structure in the stream that follows.

这篇关于检查一个元素是否在C结构内部存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆