Hi,
I want to create an array based on the result from a mysql query.
ie.
Code:
int num_to_create;
struct ftp_details {
char *host;
char *userpass;
char *options;
long sid;
long fid;
};
num_to_create = mysql_num_rows(res); // returns 1
struct ftp_details ftpdetails_array[num_to_create];
Later in program i get a segfault by code trying to use the array, however i can fix it by changing the code to
Code:
struct ftp_details ftpdetails_array[1];
So is it possible to declare an array with an integer?
Thanks,