Loop
A control structure that allows a statement or a group of statements to be executed several times
Initialization
conditions
body
change of state
What are the 4 components of a loop?
Accumulator
It is sum of the variables of the counter
For loop
It is a loop used to repeat a specific block of code a KNOWN number of times
while loop
It is a loop used to repeat a specific block of code an UNKNOWN number of times
do-while loop
A loops used when a block of code is needed o be executed at least once
False
True or false
In for (initialization; condition; dec) loop statement; the final value for the loop control variable should be greater than the initial value in order to execute the statements inside the for loop
True
True or False
In for (Initialization; condition; inc) loop statement; the initial value of the loop control varable should be less than the final value in order to execute the statements inside the for loop
Array
It is a collection of variable of the same type that are referenced by a common name.
Extraction
It is a function that accepts an array a and element of its index type i and returns an element of the array’s base type
ex: cout << a[i];
Storing
It accepts an array a, an element of its index type i, and an element of its base type x
ex: a[1]=4
300
How many elements can int name [30][10] store?
rows
in int name [30][10], what does 30 determine?
columns
in int name [30][10], what does 10 determine?
True
True or false
The index for a 2D array should always be an int
False
True or false
It is possible to run a 2D array using variables instead of int constants
ex: int name [a][b];
Functions
These are the building blocks in C language. It is a subroutine that containts one or more C statements that performs one or more tasks
Function definition
it is a set of instructions for perfoming a task
Local variable
A variable defined within a function
It cannot be recognized by other functions
Global variable
a variable declared outside of all functions and can be used in any part of the program
Formal Parameter
They are variables that are declared to ACCEPT the actual parameter values
Actual Parameter
They are values that are given or passed to the formal parameter
Function Header
What is A called?
Function Body
What is B called?
Function definition
What is C called?
Length()
A string function that counts how many characters are in a string
find()
a string function that finds a specific character or group of characters in a string
substr()
a string function that is used for extraction
insert()
a string function that inserts a word or character within a string
assign()
a string function that assigns a value to a string
concatenation/append
a string function that joins two or more strings together