0
Functions Using void Pointers
C Output 6 squared is 36 ./Playground/file0.c: In function 'main': ./Playground/file0.c:8:10: warning: assignment to 'int' from 'void *' makes integer from pointer without a cast [-Wint-conversion] 8 | sq_int = square(&x); | ^ ./Playground/file0.c: In function 'square': ./Playground/file0.c:18:9: warning: returning 'int' from a function with return type 'void *' makes pointer from integer without a cast [-Wint-conversion] 18 | return(result); | ^ this is showing error while compile. is it intended?
4 Answers
+ 2
Could you please share your code?
+ 1
Please share your code.
+ 1
I believe this is the sample code given in the C course under
"Strings & Function Pointers" -> "void Pointer" -> Page 2/3.
The sample code shown there is deeply flawed and would produce these warnings.
0
This is the given sample code.