I created the following function and my program crashed. If it is not possible for functions to call themselves, what would a reasonable workaround be?

void move_tab (MENU_TAB* m, int a)
{
int j = 0;
int k = 0;
while (k <= m->pan_num)
{
m->panels[k]->pos_y += a;
k += 1;
}
k = 0;
while (k <= m->tex_num)
{
m->texts[k]->pos_y += a;
k += 1;
}
k = 0;
while (k <= m->tab_num)
{
move_tab (m->sub_tabs[0], a);
k += 1;
}
}

Thanks in advance!