1/40
Flashcards covering vocabulary related to repetition structures, loop phases, increment/decrement operators, types of looping, while loops, for loops, do-while loops, nested loops, functions, arrays, strings, and related concepts in C programming.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Repetition
Execution of the same block of code in a program repeatedly.
Initialization (in loops)
The starting value assigned to a variable that determines the loop's initial value.
Condition (in loops)
Specifies how many times the set of instructions in a loop will be executed and when the repetitions stop, often using logical expressions.
Loop Body
Statements and actions that you want the program to repeat, enclosed in open and close brackets.
Counter (in loops)
The number of times an action is repeated in a loop, can be incremented or decremented.
Increment and Decrement Operators
Operators that modify the value of a variable by increasing or decreasing it by 1.
Pre-increment
The variable is incremented first, then used in the expression.
Post-increment
The current value of the variable is used first, then it is incremented.
Pre-decrement
The variable is decremented first, then used in the expression.
Post-decrement
The current value of the variable is used first, then it is decremented.
FOR loop
A loop best used when the number of iterations is already known.
WHILE loop
A loop best used when the number of iterations is unknown and checks the condition before executing the block of code.
DO-WHILE loop
A loop that functions the same as the while loop, but the condition is checked after the body of the loop has been executed, ensuring it runs at least once even if the condition is initially false.
WHILE Loop
A repetition control structure that repeatedly executes statements as long as the specified condition remains true.
FOR Loop
A repetition control structure that repeatedly executes statements as long as the specified condition remains true, with initialization, condition, and increment/decrement steps.
DO-WHILE Loop
A loop where the condition is checked after the loop body runs, ensuring the code inside is executed at least once.
Break Statement
Used to immediately terminate a loop, preventing any further iterations.
Continue Statement
Skips the current iteration and moves to the next cycle of the loop.
Nested Loops
A loop inside another loop; the inner loop executes its entire sequence of steps for each iteration of the outer loop.
Modularization in C
Breaking a program into smaller, manageable sections called functions, each handling a specific task.
Built-in Functions
Pre-built functions available in C, accessed through header files, that perform common tasks.
User-Defined Functions
Custom functions created by the programmer to perform specific tasks tailored to the program’s requirements.
Void Functions
Functions that do not return any value; they are typically used for performing actions like displaying output or modifying global variables.
Local Variables
Variables declared within a specific function, accessible only within that function.
Global Variables
Variables declared outside any function, making them accessible and modifiable by all functions in the program.
Static Variables
Variables that are initialized only once and retain their value for the duration of the program, but are only accessible within the function or file where they are declared.
Pass by Value
A method where a copy of the actual value is passed to a function, ensuring that modifications inside the function do not affect the original variable.
Recursion
A function calls itself, either directly or indirectly. It’s solves a problem by breaking it down into smaller subproblems of the same type.
Base Case (Recursion)
Acts as a termination condition for a recursive function to prevent infinite recursion.
Recursive Case
A condition under which a function continues to call itself, allowing the recursion process to proceed.
Arrays
Data structures that stores elements of the same data type in contiguous memory locations which are accessed by an index number.
One-Dimensional Array
The simplest type of array, where elements are stored in a linear order.
Two-Dimensional Array
An array that has exactly two dimensions. They can be visualized in the form of rows and columns organized in a two-dimensional plane.
String
In C programming, strings are arrays of characters terminated by a special character called the null terminator (‘\0’), which signals the end of the string.
strcpy()
Copies string s2 into the destination string s1, including the terminating null character. After copying, sl will be identical to s2.
strncpy()
Copies at most n characters of string s2 into destination s1. If s2 is shorter than n, the remaining space is filled with null characters ('\0'). If s2 is longer or equal to n, destination string will not automatically be null-terminated.
strcat()
Appends (concatenates) the string s2 to the array s1. The initial character of s2 replaces the terminating null character of s1. The destination array s1 must be sufficiently sized to accommodate both the original content and the appended string, including the null terminator.
strncat()
Appends at most n characters of string s2 to array s1. The first character of s2 overwrites the terminating null character of s1. The value of s1 is returned.
strlen()
Determines the length of string s pointed by s. This function counts characters until the null character is found.
strncmp()
Compares up to n characters of the string s1 with the string s2. The function returns 0, less than 0, or greater than 0, if s1 is equal to, less than, or greater than s2, respectively.
strcmp()
Compares the string s1 with the string s2. The function returns 0, less than 0, or greater than 0 if s1 is equal to, less than, or greater than s2, respectively.