Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   How to store struct in an array? (http://www.go4expert.com/forums/store-struct-array-t8969/)

boschow 21Feb2008 14:27

How to store struct in an array?
Hi all,
it is possible to store structs in an array.

Lets say that i have 5 structus. All 5 of m have different elements. And i need all their elements stored in an array? See example below:


typedef struct
    int a;
    int b;

typedef struct
  unsigned a:1;
  unsigned b:1;
  unsigned c:1;

typedef struct
  char name1;
  char name2;
  char name3;

Now i am asking you if it is possible to write an array (see example below) in C programing language?


char var[9] = {{Math.a}, {Math.b}, {coils.a}, {coils.b}, {coils.c}, {nemes.name1}, {names.name2}, {names.name3}, {names.name4}};
Best Regards,

All times are GMT +5.5. The time now is 02:14.