0

How do you pass a char * function as an argument within a function? (Solved)

I am trying to pass the char * function to return the pointer in order to latter create a dynamic char * size. In line 74 I have an incompatible pointer type ‘char * (*)(void). https://code.sololearn.com/caR1K53CBvZm/?ref=app

7th Oct 2023, 1:01 PM
William Owens
William Owens - avatar
1 Respuesta
+ 1
the warning tells you exactly what it is. It says : ---- " assignment to 'char *' from incompatible pointer type 'char * (*)(void)' " ----- < newnode->data.somestr > is expecting a data type < char * >. you are passing in <strfun>, which is just a < char*(*)() >, you have to call <strfun>: -------- newnode->data.somestr = strfun(); // line 74 --------
7th Oct 2023, 3:19 PM
MO ELomari
MO ELomari - avatar