T
Twister
Hi All,
I have a question which might sound very basic.
I have a simple structure:
struct simple{
void *buffer;
};
typedef struct simple Simple;
In my function I do this:
void do_Something(){
Simple *simp_struct;
simp_struct->buffer = malloc(10 * sizeof(int *));
call_func((void **)((int **)(simp_struct->buffer)));
....
}
The function call_func has this prototype:
call_func(void **buf);
I am confused with this piece of code:
call_func((void **)((int **)(simp_struct->buffer)));
What does this construct mean? How is that simp_struct->buffer
(which is a void *) is being cast to a int** followed by a
cast to void ** and passed to call_func ?
Rgds.
Mirage
I have a question which might sound very basic.
I have a simple structure:
struct simple{
void *buffer;
};
typedef struct simple Simple;
In my function I do this:
void do_Something(){
Simple *simp_struct;
simp_struct->buffer = malloc(10 * sizeof(int *));
call_func((void **)((int **)(simp_struct->buffer)));
....
}
The function call_func has this prototype:
call_func(void **buf);
I am confused with this piece of code:
call_func((void **)((int **)(simp_struct->buffer)));
What does this construct mean? How is that simp_struct->buffer
(which is a void *) is being cast to a int** followed by a
cast to void ** and passed to call_func ?
Rgds.
Mirage