struct to bidimensional struct pointer assigment in C
- by argos.void
i want to get work this code and i googled and asked in efnet and freenode but i didnt find the answer.
what i want i to assign a struct woot to an another bidimensional struct woot *, and i need malloc to do that.
then, how can i use malloc there and how to assign the struct?
thanks.
#include <stdio.h>
struct omg {
int foo;
};
struct woot {
struct omg *localfoo;
int foo;
};
int a = sizeof(struct woot);
int main(void){
struct woot *what[10][10] = (struct woot *) malloc(100*a);
struct omg hahaha[100];
hahaha[1].foo = 15;
what[1][6].localfoo = &hahaha[1];
}