0% found this document useful (0 votes)
1 views3 pages

Comp-Reviewer - G9

Uploaded by

ramayah011910
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views3 pages

Comp-Reviewer - G9

Uploaded by

ramayah011910
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Comp Reviewer (Wallahi)

Array - collection of variables of the same data type; groups of data of the same type referenced under
one name; collection of data storage locations

Array Element – Every value in an array; individual content of the array

Format for defining an ARRAY:

datatype arrayName[size];

ELEMENTS OF AN ARRAY:

Datatype – valid data type in C++; MUST USE VALID DATATYPE

arrayName – User-defined name; User defines the name

size – integer which indicates the SIZE of the array

example of an ARRAY:

int exam[4];

Initializing Array – to initialize, value are assigned right after their declaration (Creation) with the use of
Assignment operators (+, -, *, /, =)

Multidimensional Arrays – Arrays that can be represented using more than one dimension

Initializing Multidimensional Arrays – Uhm, how do I explain? (First size value = number of elements in
group, second size value = number of groups) (Size value is [size])

Char Arrays – Array that contains Char (Characters)..

String – Array of characters ending with a null value

Structured Data Type - a number of distinct data items, of different types, grouped together as one unit

Subscript - the number of elements in the array, surrounded by brackets

Byte – series of 0’s and 1’s usually a group of EIGHT BITS

Pointers – Variables used to store memory locations

Asterisk (*) – Used to tell the compiler to reserve a memory space that can hold a memory address
Garbage Values – HAS NO USE; INSIGNIFICANT VALUES; USELESS; Values assigned to declared variables
when not initialized

Ampersand (&) – refers to the address of a variable

*ptr - if ptr is declared as a pointer, this translates to “the contents of the address stored in the variable
ptr”

&x - translates to “the address of the variable x”

Memory Management – Managing of memory…; stores knowledge by recollection (Recall/Remember)


Function – Make programs modular; Contains statements that performs a task or returns a value

EVERY C++ PROGRAM HAS ATLEAST ONE FUNCTION which is always main()

Things to remember when using Functions:

1. A function must be declared prior to its use except when it is already defined.
2. The parameter list of a function may have parameters of any data type.
3. Parameters are optional.
4. The number and data types of parameters should match the number and data types of the arguments
passed on to it.
5. The return statement is used to return a single value from a function. It usually appears at the last line
of a function but it may also appear anywhere within a function.
6. The return statement is optional.
7. If the data type of the value returned by a function is not declared, it is converted to int.
8. If a function does not return a value, its return type will be void.

General format of a function:

datatype functionName (Parameter List);

Global Variables – Variables declared OUTSIDE a function; GLOBAL SCOPE


Local Variables – named as such because it can only be used in the function they are declared in; LOCAL
SCOPE

Scope – section of code where a variable is allowed to be accessed or referenced

Pass-by-Reference Method - parameters only accept values from other functions of the program;
arguments and parameters refer to the same memory location; addresses of arguments are passed

it is valid to give several functions the same name. The only requirement is that it should have a different
set of parameters, whether data types or a number of parameters.

Tldr: function can use same name, but need different set of parameters or data type

Overloading Functions – Function use same name but different set of parameters or data type; Example
of polymorphism; allows functions to have many forms

Address-of Operator (&) - returns the address of the pointer

Arguments - values which may be variables or expressions passed on to the function and are normally
found in the function call

Indirection Operator (*) - returns the value of the address stored by the pointer

Return Statement - used to return a single value from a function

Return Values - the results of the function which may be passed to another function

Pass-by-Value Method - parameters only accept the values passed on to them


Parameters - found and declared in the function header; accept values from the program or another
function

Function Prototype – datatype functionName (Parameter List); - way of identifying the data types of any
return value and parameter for the compiler so it can perform error-checking

You might also like