I have a function int rt_task_start (RT_TASK *task, void(*task_func)(void *arg), void *arg)
where in second argument i am passing a function with argument.
- When i only pass a function name at that time there is no problem.(as expected it's working).
rt_task_start(&demo_task1, demo, 1);
- But when i pass
rt_task_start(&demo_task1, demo(&val), 1);
it's giving me errorerror: invalid use of void expression
. Variable val is defined before.int val = 0;
- When i call with this
rt_task_start(&demo_task1, demo(val), 1);
this is showing errorWarning passing argument 1 of 'demo' makes pointer from integer without a cast
thenerror: invalid use of void expression
. int *val; *val = 0;
rt_task_start(&demo_task1, demo(&val), 1);
this is also giving me error.
I can't understand what should i pass, as a void pointer. It's giving me error. Any Idea Please!
int *val; *val = 0;
will probably create a segmentation fault since you're assigning a value to an undefined address location. – Fussellvoid(*task_func)(void *arg)
what type of parameters it can take. I though that i can send argument too, for case 2,3,4 which are incorrect at all. – Disparagement