如何枚举基于C分配内存? [英] How does Enum allocate Memory on C?

查看:209
本文介绍了如何枚举基于C分配内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用C语言和汇编(intelx8086)lenguage工作。

I'm trying to work with C and Assembly (intelx8086) lenguage.

我还使用一个类我的一个朋友给我说有个

I'm also using one class a friend of mine gave me that has a

typedef enum data_10 {a=0,b=7,c=10,} data_10_type;

我想与这个类按位(AKA构造它/销毁它的组件)的工作。我的问题是,有多少内存枚举走?

I want to work with this class bitwise (AKA construct it/destroy it on Assembly). My question is, how much memory does "enum" take?

推荐答案

虽然可以从编译器编译器不同,枚举通常采用相同的尺寸为 INT 。可以肯定的,但是,你总可以使用的sizeof(data_10_type);

Although it may vary from compiler to compiler, enum typically takes the same size as an int. To be sure, though, you can always use sizeof( data_10_type );

这篇关于如何枚举基于C分配内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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