this is the code
char Login(MYSQL *conn, MYSQL_RES *res, MYSQL_ROW row,char *user,char *password){conn = mysql_init (NULL);//printf("%s",user); mysql_real_connect (conn, opt_host_name, opt_user_name, opt_password, opt_db_name, opt_port_num, opt_socket_name, opt_flags);if(mysql_real_query(conn,"SELECT password From User where username='%s';",*user)){ fprintf(stderr, "%s \n", mysql_error(conn)); printf("ERRO %s",mysql_error(conn)); printf("Press any key to continue. . . \n");// getch(); exit(1); } //printf("%s",user); res=mysql_use_result(conn);while((row = mysql_fetch_row(res))!=NULL){ if(strcmp(row[0],password)==0){printf("%s\n",row[0]);printf("DEU\n");exit(1);}elseprintf("ERRO");printf("%s\n",row[0]);mysql_close (conn);exit(1);}}//Connecção a base de dados char connection_database(MYSQL *conn, MYSQL_RES *res, MYSQL_ROW row){conn = mysql_init (NULL); mysql_real_connect (conn, opt_host_name, opt_user_name, opt_password, opt_db_name, opt_port_num, opt_socket_name, opt_flags); if(mysql_query(conn, "show tables")) { fprintf(stderr, "%s \n", mysql_error(conn)); printf("Press any key to continue. . . \n");// getch(); exit(1); } res = mysql_use_result(conn); printf("Tables in database\n"); while((row = mysql_fetch_row(res)) != NULL) printf("%s \n", row[0]); mysql_close (conn); printf("Press any key to continue . . . \n");}/*menuprincial(){} */int main (int argc, char *argv[]){ MYSQL *conn; /* pointer to connection handler */ MYSQL_RES *res; /* holds the result set */ MYSQL_ROW row;char password[200]="ola";char user[200]="admin";//connection_database(conn,res,row); Login(conn,res,row,user,password); return 0;}