Создание массива кнопок gtk в c

Мне нужно создать массив кнопок на C. Я не уверен, что мне не хватает, пожалуйста, помогите мне. Вот мой массив:

GtkWidget *button[5];
int i;
for ( i =1; i<5; i++)
        button[i] = gtk_button_new();

Затем я создаю остальные кнопки ... Я используюbutton [i] а потом в конце я делаю этоi++; Это, вероятно, не лучший способ, но я просто не уверен, когда я создаю массив, как мне передать кнопку 1, кнопку 2 и т. Д. В остальных моих утверждениях? Пожалуйста, любая помощь приветствуется. постскриптум Я новичок в C, не будь груб со мной, ты :)

 /* Creates a new button with the label "Button 1". */
button[i] = gtk_button_new_with_label ("Button 1");

/* Now when the button is clicked, we call the "callback" function
 * with a pointer to "button 1" as its argiument */
g_signal_connect (button[i], "clicked",
                  G_CALLBACK (callback), "Run button 1");

/* Instead of gtk_container_add, we pack this button into the invisible
 * box, which has been packed into the window. */
gtk_box_pack_start (GTK_BOX (box1), button[i], TRUE, TRUE, 0);

/* Always remember this step, this tells GTK that our preparation for
 * this button is complete, and it can now be displayed. */
gtk_widget_show (button[i]);
i++;

Ответы на вопрос(1)

Ваш ответ на вопрос