I am having an error after compiling the program with above warning. i believe i'm doing something wrong my code is as below. program terminates with seg fault

in main i'm calling sqlfunction.cpp to query mysql database.
timer loop dumps the result to the mysql database by querying sqlfunction.
program runs in the main ok even with the warnings. but it doesnt run in the timer loop and terminates with seg fault.????? please help what should i change in this

in main cpp

void *timer(void *arg)

int ret;
char command[1024];
double Myarray[3000];

while (1){
clock_t endwait;
endwait = clock() + 1 * CLOCKS_PER_SEC;
while (clock() < endwait){}//do nothing

float mul=0;
mul= GetNemo(0);
mul= MyFloat(mul);
printf("timed float ===== %f\n",mul);

int i = 0;
sprintf(command,"insert into meter (Voltage) values (%f);",mul); //warnign here
ret = Querydb(command,Myarray);
printf("Querydb = %d\n",ret);

return arg;
int main(int ac, char **av)

int s, ret;

ret = Opendb("localhost","root","pass","tetsdB"); //warning nere
printf("opendb = %d\n",ret);

ret = thread.create(timer,NULL); //THREAD FOR TIMER
printf("thread_timer ret = %d\n", ret);

double Myarray[128];
int i = 0;
char command[1024];

ret = Querydb("insert into table (Voltage) values (10);",Myarray);
if(ret != 0){
printf("myarray ==== %f\n",Myarray[i]);}

.h file

extern bool Opendb(char *pc, char *user, char *pass, char *db);
extern bool Closedb();
extern bool Querydb(char *query, double *Myarray);
extern int GetNemo(int bytes);

in sqlfuntion.cpp one of the function is..

bool Querydb(char *query, double Myarray[3000])
int i=0;
char buffer[50];
double value1;
if (mysql_query(conn, query)) {
fprintf(stderr, "%s\n", mysql_error(conn));
return 0;

else {
res = mysql_use_result(conn);
//output table name
printf("MySQL Tables in mysql database:\n");
while ((row = mysql_fetch_row(res)) != NULL){
value1 = atof(buffer);
return 0;