Hey guys i stumble upon a code online which was written in C language and while reading the codes i saw the for
loop did not have initialization
,condition
nor the increment
. The loop looked like this.
for (;;)
{
bool main_flag = false;
while (main_flag == false)
{
displayMainMenu();
switch (main_input)
{
case 1: addCar(head, tail); main_flag = true; break;
case 2: removeCar(head, tail); main_flag = true; break;
case 3: display(head, tail); main_flag = true; break;
case 4: printf("Terminating..."); return 0;
default: printf("\nINVALID INPUT!\nTRYAGAIN !\n");
}
}
}
Anyone able to explain to me what kind of for
loop is that and how does it work? thanks alot