Arrays
can be passed as parameters to a function either by value or by reference.
Zero
In C++, an array index starts with
compile time
The size of an array is determined at
one-dimensional array
A ———————————— is an example of a primitive or built-in data type, not a structured data type.
double type
is an example of a simple data type
not ignore
When declaring a one-dimensional array as a formal parameter, you usually omit the array size. If you specify the size of a one-dimensional array in the formal parameter declaration, the compiler will ____________ the size.
One Dimensional Array
is an array in which the components are arranged in a list form
Array
is a collection of a fixed number of components all of the same data type.
Subscript
indicates the variable’s position in the array and is assigned by the computer when the array is created in internal memory.
square brackets '[]’
used to declare arrays and to access elements of an array
arrayName [subscript] = expression;
Syntax for assigning data to an array is
int num1[6] = {9};
To declare and initialize a six-element integer array name num1 initialized to 9
datatype arrayName [NumberOfElements] = {value};
The syntax in declaring and initializing the 1D array is
Functions
Every recursive function must have one or more base cases.
Recursion.
The process of solving a problem by reducing it to smaller versions of itself is called
Pointers
are a special type of variable that contains memory address as their value.
function
prototype is a declaration of the function that tells the program about the type of the value returned by the function and the number and type of arguments.
function
block of code that performs specific tasks. It is used to divide a problem into smaller parts to make a program easy to understand.
function
cannot return a value of type array.
void
In C++, the function header for a function that does not return a value begins with the keyword
local variables
Variables that can be used only by the function in which they are declared are called?
void displayName();
The correct function prototype for a void function that requires no formal parameters? The function’s name is displayName.
void function
does not return a value after completing its assigned task
void function
call typically appears as its statement in a C++ program.
void function
header begins with the keyword void.
displayTaxes(federalTax, localTax);
C++ statement that calls a void function named displayTaxes, passing it a copy of the contents of two double variables named federalTax and localTax. -
void functionName (parameters) {}
Syntax for void function
struct
is a collection of a fixed number of components.
Struct
not a reserved word, it is a keyword in C++
Scalar Variable
_____________ is unrelated to any other variable in memory.
Return
statement typically is not the last statement in a C++ void function