views:

72

answers:

2

Can I use a forloop to get the property names of a "struct" in C? Or would I just have make a separate list? (Just the name I am looking for)

A: 

for loops do not have the ability to enumerate struct members in C, no. In fact, once compiled, a C program really doesn't have any concept of the member names at all, it just uses offsets from the struct pointer.

Amber
+3  A: 

You'll have to make a separate list. The C programming language doesn't have any introspection capabilities that would let you enumerate the property names of a struct.

dmazzoni