ok so lets say you have a square jxj matrix.
yes you would create these in a loop but you declare them outside the loop. Depending on the scope of what you are doing, you might not have to a declare a full array, e.g.:
Code:
gboolean toggle_cb(GtkToggleButton* widget, gpointer data)
{
int k;
k=GPOINTER_TO_INT(data);
...
}
...
GtkWidget* button;
for (i=0;i<j;i++)
{
for (k=0;k<j;k++)
{
button=gtk_check_button_new();
g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(toggle_cb), GINT_TO_POINTER((i*j)+k));
..
}
}
...
The signal connect passes both the widget itself as well as another parameter (I made use of the array indices in this case).