# Radio Buttons

    #include <stdio.h>
    #include "graphapp.h"

    Control *tomato, *barbeque;

    void place_order(Control *b)
    {
      printf("Sauce:\n");
      if (is_checked(tomato))     printf("  Tomato\n");
      if (is_checked(barbeque))   printf("  Barbeque\n");
      exit(0);
    }

    void choose(Control *sauce)
    {
      if (sauce == tomato)         printf("Tomato sauce chosen\n");
      else if (sauce == barbeque)  printf("BBQ sauce chosen\n");
    }

    int main(int argc, char *argv[])
    {
      App *app;
      Window *w;
      Rect r;

      app = new_app(argc, argv);
      w = newwindow(app, rect(0,0,200,180), "Pizza", STANDARD_WINDOW);
      r = rect(10,10,100,25);

      tomato   = new_radio_button(w, r, "Tomato", choose); r.y += 30;
      barbeque = new_radio_button(w, r, "BBQ", choose);    r.y += 30;
      check(tomato);

      new_button(w, r, "Order Pizza", place_order);
      show_window(w);
      main_loop(app);
      return 0;
    }

Notes:

- Use `new_radio_button` to create a radio button control.
- Notice how the `choose` call-back function has been used by both radio buttons. Whenever either radio button is toggled, that function is called.
- The `is_checked` function determines if a radio button is checked.