Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

How do I do it in C?

Name: Anonymous 2008-05-09 4:36

Hello /prog/. Imagine I have a struct:

struct foo {
 enum entype { option1, option2 } *bar;
};

"bar" here stands for an array of enums, as you see.
Somewhere in my prog (after correctly allocating needed number of foo`s and bar`s) I have to access Nth bar in foo. I'm currently using this line:

*(enum entype*)(myfoo->bar + sizeof(enum entype)*N) = option1;

Well, it works, but I still think I'm doing it wrong. There must be an easier way, like myfoo->bar[N] or something.

Name: Anonymous 2008-05-09 4:47

>>2
problem solved, gentlemen.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List