1/22
Flashcards covering decision statements, loop structures, jumping statements, recursion concepts, and stack memory management in C programming.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Decision Statements
Statements used to make decisions in a program based on conditions, where a block of code is executed depending on whether the condition is true or false.
if STATEMENT
A control structure that executes a block of code if the condition is true.
if-else STATEMENT
A decision statement that executes one block of code if the condition is true and another if it is false.
else-if ladder
A control structure used to check multiple conditions one by one.
switch STATEMENT
A control structure that selects one block of code from many options based on an expression; it is efficient when the same variable is compared with many values.
Fall-through
The execution of the next case in a switch statement; prevented by using the break statement.
for loop
An entry-controlled loop generally used when the number of iterations is known in advance; initialization is executed only once, followed by the condition check and update.
while loop
An entry-controlled loop used to execute statements repeatedly as long as a given condition is true; typically used when the number of iterations is not known in advance.
do-while loop
An exit-controlled loop that executes a block of statements at least once, then repeats as long as the condition is true.
Jumping Statements
Statements used to transfer the control from one part of the program to another, including break, continue, goto, return, and exit().
break
A jumping statement that terminates a loop or switch statement and moves control to the statement immediately following it.
continue
A jumping statement that skips the remaining statements in the loop for the current iteration and moves control to the next iteration.
goto
A jumping statement that transfers control to a labeled statement within the same function.
return
A jumping statement that terminates a function immediately, returning control and potentially a value to the calling function.
exit()
A function defined in <stdlib.h> that terminates the program immediately.
exit(0)
A specific call to the exit() function representing normal termination of a program.
exit(1)
A specific call to the exit() function representing abnormal termination of a program.
Recursion
A programming technique in which a function calls itself directly or indirectly until a certain condition is met to solve a problem by breaking it into smaller subproblems.
Base Case
The stopping condition in recursion under which the function stop calling itself.
Recursive Case
The part of a recursive function where it calls itself with a smaller or modified input.
Stack frame (activation record)
A record created and pushed onto the stack when a function is called, initialized with parameters, local variables, and a return address.
Stack overflow
A condition that may occur in recursion if a base case is missing or the recursion depth is too large, exceeding memory limits.
Return address
A stored value in the stack frame that allows control to return to the caller after a function finishes execution.