Control flow statements are key in C programming, allowing your code to make decisions and repeat actions. They help manage how your program runs based on conditions, making it flexible and efficient for various tasks.
if statement
if (condition) { /* code to execute */ }
if-else statement
if (condition) { /* code if true */ } else { /* code if false */ }
switch statement
switch (variable) { case value1: /* code */ break; case value2: /* code */ break; default: /* code */ }
for loop
for (initialization; condition; increment) { /* code to execute */ }
while loop
while (condition) { /* code to execute */ }
do-while loop
do { /* code to execute */ } while (condition);
break statement
break;
continue statement
continue;
goto statement
goto label; label: /* code to execute */
return statement
return value;