AlgorithmAn algorithm is defined as the sequence of specific actions to be executed in a precise order to solve a given problem. For example, steps outlined in pseudocode to calculate a class average represent an algorithm.
Program ControlProgram control defines the specific order in which statements are evaluated and executed within a computer program. It ensures that instructions follow the logical roadmap established by the developer.
PseudocodePseudocode is an artificial or informal language resembling everyday English used to develop and structure algorithms without computer execution. It allows developers to plan logic easily before translating it into C.
Sequence StructureThe sequence structure is the default control structure in programming where statements are executed sequentially one after another. No special syntax is required for default linear statement execution.
Selection StructureA selection structure allows a program to choose among alternative paths of action based on logical conditions. Examples in C include the if, if-else, and switch statements.
Repetition StructureA repetition structure is used whenever a set of actions needs to be repeated continuously while a specific condition remains true. Common examples in programming include while, do-while, and for loops.
The if StatementThe if statement is a single-selection structure that executes a block of code only when its evaluated condition returns true. If false, the program skips the block and moves to the next statement.
Indentation and WhitespaceIndentation improves program readability for human programmers, while C compiler ignores all whitespace characters such as spaces, tabs, and newlines. Proper indentation visually represents code hierarchy.
The if-else StatementThe if-else statement is a double-selection structure that specifies one action for a true condition and a distinct alternative action for a false condition. It ensures binary decision coverage.
Ternary Conditional OperatorThe ternary operator (?:) is a compact shorthand operator taking three arguments: a condition, an expression if true, and an expression if false. It can replace simple if-else blocks inside print statements.
Nested if-elseNested if-else statements involve placing selection structures inside other selection structures to test for multiple sequential cases. When a condition evaluates to true, the remaining checks are skipped.
Compound StatementA compound statement is a collection of multiple individual statements grouped together within a pair of opening and closing curly braces. It allows multiple lines to be treated as a single block.
BlockA block is a specialized compound statement that includes internal variable declarations within its braces. Blocks define the scope and lifecycle of local variables in C.
The while Repetition StatementThe while repetition statement repeatedly executes a target statement or block as long as its governing condition evaluates to true. For example, adding numbers while x is less than 10.
Top-down Stepwise RefinementTop-down stepwise refinement is a design methodology where complex algorithms are broken down from a high-level description into smaller, manageable sub-tasks and implementation phases.
Assignment OperatorsAssignment operators are shorthand symbols like +=, -=, *=, /=, and %= used to update variable values more concisely than writing full assignment expressions. For instance, a += 5 replaces a = a + 5.
Increment and Decrement OperatorsIncrement (++) and decrement (--) operators modify a variable's value by one and can operate in either prefix or postfix modes. Postfix evaluates before changing, while prefix changes before evaluation.