Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'Invalid conversion from some_type** to const some_type**'

I've got a function that requires const some_type** as an argument (some_type is a struct, and the function needs a pointer to an array of this type). I declared a local variable of type some_type*, and initialized it. Then I call the function as f(&some_array), and the compiler (gcc) says:

error: invalid conversion from ‘some_type**’ to ‘const some_type**’

What's the problem here? Why can't I convert a variable to const?

like image 952
petersohn Avatar asked Apr 20 '10 07:04

petersohn


1 Answers

See: Why can't I pass a char ** to a function which expects a const char **? from the comp.lang.c FAQ.

like image 188
jamesdlin Avatar answered Nov 08 '22 07:11

jamesdlin