It looks like you are trying to build a string. For that you can use snprintf
.
char sql[64];
int size = snprintf(sql, 64, "SELECT %lf/(%lf * %lf);", peso, altura, altura);
Note that I kept the return value. This is to handle any future error where you modify a statement in a way that might result in buffer overflow or other error. You can probably just deal with this by using a debug assertion, as this pre-sized string should be large enough to hold the intended SQL.
if (size < 0 || size >= 64) {
assert(0);
return 0;
}
However, since you are using sqlite library, you should instead use the proper methods to prepare a statement and bind values to it, rather than inserting the values into the string yourself.
solved error: incompatible types when initializing type ‘char *’ using type ‘double’