Greetings.
I need help making a dynamic array with 3 columns, the problem is that i don't know at run-time how many rows there must be allocated.
So i need to allocate one row every time.
I have this as code:
gchar ***servers_array = NULL;
servers_array = realloc(servers_array, (detected_netstat_servers * 3 * sizeof(gchar*)) + (3 * sizeof(gchar *)));
I know it's wrong, so i tried this:
gchar ***servers_array = NULL;
servers_array = malloc(3 * sizeof(gchar *));
for(i = 0; i < 3; i++)
{
servers_array[i] = malloc(rows * sizeof(int));
}
Or must i simple make a 1D array of pointers to arrays of 3 columns?