A
ArifulHossain tuhin
I have this structure like following :
typedef struct{
char static_data[10];
int a;
int b;
} my_ds;
i have initialized it like following:
my_ds * ds = (my_ds *)malloc(sizeof(my_ds));
memmove(my_ds->static_data, buf, len);
ds->a = c;
ds->b = d;
and passed it in a function:
int my_fun(void ** data);
my_fun((void *)&ds);
what happens inside my_fun, the first field, static[10] is initialized correctly but other two values are zero. What am i missing here?
typedef struct{
char static_data[10];
int a;
int b;
} my_ds;
i have initialized it like following:
my_ds * ds = (my_ds *)malloc(sizeof(my_ds));
memmove(my_ds->static_data, buf, len);
ds->a = c;
ds->b = d;
and passed it in a function:
int my_fun(void ** data);
my_fun((void *)&ds);
what happens inside my_fun, the first field, static[10] is initialized correctly but other two values are zero. What am i missing here?