C
Chris
I've lurked around long enough... Time to interract =)
I'm trying to make sense of the following. I can't quite wrap my head
around what this is actually doing:
-------------
typedef enum { DOUBLE_LIST, INT_LIST } DATA_TYPE;
typedef struct {
DATA_TYPE type;
int number_values;
} section_t;
-------------
These declarations describe the header of each of a number of sections
of a binary file (so the assignment is to use this info to read and
make sense of the data in a supplied data file).
Now, I typed this stuff into a small program and ran it though gcc.
gcc had no complaints, but I'm puzzled as to how, in the struct,
DATA_TYPE can be a valid type, since in the enum there is DOUBLE_LIST
and INT_LIST... nothing that seems like a type that a compiler would
understand without more information.
If someone could provide me with the approximate English translation
of the above statements, I'd greatly appreciate it. /Someday/ I'll be
a passable programmer =)
Thanks again.
-chris
*-also posted on .moderated, but saw that there wasn't much recent
activity there =)
I'm trying to make sense of the following. I can't quite wrap my head
around what this is actually doing:
-------------
typedef enum { DOUBLE_LIST, INT_LIST } DATA_TYPE;
typedef struct {
DATA_TYPE type;
int number_values;
} section_t;
-------------
These declarations describe the header of each of a number of sections
of a binary file (so the assignment is to use this info to read and
make sense of the data in a supplied data file).
Now, I typed this stuff into a small program and ran it though gcc.
gcc had no complaints, but I'm puzzled as to how, in the struct,
DATA_TYPE can be a valid type, since in the enum there is DOUBLE_LIST
and INT_LIST... nothing that seems like a type that a compiler would
understand without more information.
If someone could provide me with the approximate English translation
of the above statements, I'd greatly appreciate it. /Someday/ I'll be
a passable programmer =)
Thanks again.
-chris
*-also posted on .moderated, but saw that there wasn't much recent
activity there =)