can anyone help me to transform this function to a void function, using the pointer address??
Code:
int main(){
...
MYSQL *p_connection;
...
p_connection = Initiate_mysql(p_connection);
...
}
MYSQL* Initiate_mysql(MYSQL* p_connection){
const char* host = "xxxx";
const char* user = "xxxx";
const char* password = "xxxx";
const char* database = "xxxx";
p_connection = mysql_init(NULL);
if (!mysql_real_connect(p_connection,host,user,password,database,0,NULL,0)) {
fprintf(stderr, "Failed to connect to p_database: Error: %s\n", mysql_error(p_connection));
}
return p_connection;
}
thx