c - Enum data type memory allocation -
this question has answer here:
- what size of enum in c? 6 answers
- how enum allocate memory on c? 3 answers
how memory allocated for"enum" data type, found total size of enum data type 4 bytes(linux) people answers there no memory allocation, 'macros' type(int) please explain how enum members function stored while accessing , data there in 4 bytes.
thanks
the memory shall not allocated enums. remember memory allocation , processing time
(preprocessor time , compilation time) main difference between macro , enum.
for example, while doing debugging(runtime) not able see value of macro,since memory not allocated macro , not able access memory location. know value of macro, have file defined.
but enums, memory shall allocated. able access memory , see value of enum in debugging time(runtime).
so, if memory not allocated enum, how able know value in runtime. , access , gives value.
Comments
Post a Comment