POINTERS_AND_ARRAYS


The C++ program featured in this tutorial web page illustrates how to use pointer variables to instantiate arrays during program runtime. The program first prompts the user to enter a natural number value to store in a variable named S. Then the program prompts the user to enter a natural number value to store in a variable named T. Then the program will create an array named A consisting of exactly S integer values such that each of those S integer values is a random nonnegative integer value which is no larger than (T – 1). Then the program will sort the values which are stored in A in ascending order using the Bubble Sort algorithm. Then an array consisting of exactly T elements will store the number of times each unique value occurred as an element value of A. Finally, a histogram (i.e. bar graph) representation of C will be created using the values of B.

A pointer is a variable which stores the memory address of a variable. An array is a variable which is used to store some natural number of data values of the same data type. At the hardware level, an array comprised of N elements whose data type is DATA_TYPE is a contiguous block of DATA_TYPE multiplied by N memory cells.

To view hidden text inside each of the preformatted text boxes below, scroll horizontally.

int N = 99; // an int type variable which stores the initial value 99
int * P = &N; // a pointer-to-int type variable which stores the address of N 
std::cout << P; // 0x559343ab78fc (memory address of one byte-sized memory cell (and the first of four contiguous memory cells allocated to N))
std::cout << * P; // 99 (retrieved data value which is stored at the memory address which P stores)
int * K = new int [N]; // A pointer-to-int type variable named K is used to store the memory address of the first of N int-sized contiguous chunks of memory.

SOFTWARE_APPLICATION_COMPONENTS


C++_source_file: https://raw.githubusercontent.com/karlinarayberinger/KARLINA_OBJECT_summer_2023_starter_pack/main/arrays.cpp

plain-text_file: https://raw.githubusercontent.com/karlinarayberinger/KARLINA_OBJECT_summer_2023_starter_pack/main/arrays_output.txt


PROGRAM_COMPILATION_AND_EXECUTION


STEP_0: Copy and paste the C++ source code into a new text editor document and save that document as the following file name:

arrays.cpp

STEP_1: Open a Unix command line terminal application and set the current directory to wherever the C++ program file is located on the local machine (e.g. Desktop).

cd Desktop

STEP_2: Compile the C++ file into machine-executable instructions (i.e. object file) and then into an executable piece of software named app using the following command:

g++ arrays.cpp -o app

STEP_3: If the program compilation command does not work, then use the following commands (in top-down order) to install the C/C++ compiler (which is part of the GNU Compiler Collection (GCC)):

sudo apt install build-essential
sudo apt-get install g++

STEP_4: After running the g++ command, run the executable file using the following command:

./app

STEP_5: Once the application is running, the following prompt will appear:

Enter a natural number, S, for representing the number of elements to include in an array which is no larger than 1000:

STEP_6: Enter a value for S using the keyboard.

STEP_7: Another prompt for keyboard input will appear after the first input value is entered:

Enter a natural number, T, for representing the number of unique states which each element of the array can store exactly one of which is no larger than 1000:

STEP_8: Enter a value for T using the keyboard.

STEP_9: Observe program results on the command line terminal and in the output file.


PROGRAM_SOURCE_CODE


Note that the text inside of each of the the preformatted text boxes below appears on this web page (while rendered correctly by the web browser) to be identical to the content of that preformatted text box text’s respective plain-text file or source code output file (whose Uniform Resource Locator is displayed as the green hyperlink immediately above that preformatted text box (if that hyperlink points to a source code file) or whose Uniform Resource Locator is displayed as the orange hyperlink immediately above that preformatted text box (if that hyperlink points to a plain-text file)).

A computer interprets a C++ source code as a series of programmatic instructions (i.e. software) which govern how the hardware of that computer behaves).

(Note that angle brackets which resemble HTML tags (i.e. an “is less than” symbol (i.e. ‘<‘) followed by an “is greater than” symbol (i.e. ‘>’)) displayed on this web page have been replaced (at the source code level of this web page) with the Unicode symbols U+003C (which is rendered by the web browser as ‘<‘) and U+003E (which is rendered by the web browser as ‘>’). That is because the WordPress web page editor or web browser interprets a plain-text version of an “is less than” symbol followed by an “is greater than” symbol as being an opening HTML tag (which means that the WordPress web page editor or web browser deletes or fails to display those (plain-text) inequality symbols and the content between those (plain-text) inequality symbols)).

C++_source_file: https://raw.githubusercontent.com/karlinarayberinger/KARLINA_OBJECT_summer_2023_starter_pack/main/arrays.cpp


/**
 * file: arrays.cpp
 * type: C++ (source file)
 * date: 05_JULY_2023
 * author: karbytes
 * license: PUBLIC_DOMAIN 
 */

/* preprocessing directives */
#include <iostream> // standard input (std::cin), standard output (std::cout)
#include <fstream> // file input, file output
#include <stdio.h> // NULL macro
#include <stdlib.h> // srand(), rand()
#include <time.h> // time() 
#define MAXIMUM_S 1000 // constant which represents maximum value for S
#define MAXIMUM_T 1000 // constant which represents maximum value for T

/* function prototype */
void bubble_sort(int * A, int S);

/**
 * Use the Bubble Sort algorithm to arrange the elements of an int type array, A, 
 * in ascending order
 * such that A[0] represents the smallest integer value in that array and 
 * such that A[S - 1] represents the largest integer value in that array.
 * 
 * Assume that S is a natural number no larger than MAXIMUM_S.
 * 
 * Assume that A is a pointer to an int type variable and that 
 * A stores the memory address of the first element, A[0], 
 * of an int type array comprised of exactly S elements.
 * (In other words, assume that exactly S consecutive int-sized 
 * chunks of memory are allocated to the array represented by A).
 * 
 * Although this function returns no value, 
 * the array which the pointer variable, A, points to is updated 
 * if the elements of that array are not already arranged in ascending order. 
 */
void bubble_sort(int * A, int S)
{
    int i = 0, placeholder = 0; 
    bool array_is_sorted = false, adjacent_elements_were_swapped = false;
    while (!array_is_sorted)
    {
        adjacent_elements_were_swapped = false;
        for (i = 1; i < S; i += 1)
        {
            if (A[i] < A[i - 1])
            {
                placeholder = A[i];
                A[i] = A[i - 1];
                A[i - 1] = placeholder;
                adjacent_elements_were_swapped = true;
            }
        }
        if (!adjacent_elements_were_swapped) array_is_sorted = true;
    }
}

/* program entry point */
int main()
{
    // Declare four int type variables and set each of their initial values to 0.
    int S = 0, T = 0, i = 0, k = 0;

    // Declare two pointer-to-int type variables.
    int * A, * B;

    // Declare one pointer-to-pointer-to-char type variable.
    char ** C;

    // Declare a file output stream object.
    std::ofstream file;

    /**
     * If the file named arrays_output.txt does not already exist 
     * inside of the same file directory as the file named arrays.cpp, 
     * create a new file named arrays_output.txt in that directory.
     * 
     * Open the plain-text file named arrays_output.txt 
     * and set that file to be overwritten with program data.
     */
    file.open("arrays_output.txt");

    // Print an opening message to the command line terminal.
    std::cout << "\n\n--------------------------------";
    std::cout << "\nStart Of Program";
    std::cout << "\n--------------------------------";

    // Print an opening message to the file output stream.
    file << "--------------------------------";
    file << "\nStart Of Program";
    file << "\n--------------------------------";

    // Print "The following statements describe the data capacities of various primitive C++ data types:" to the command line terminal.
    std::cout << "\n\nThe following statements describe the data capacities of various primitive C++ data types:";

    // Print "The following statements describe the data capacities of various primitive C++ data types:" to the file output stream.
    file << "\n\nThe following statements describe the data capacities of various primitive C++ data types:";

    // Print the data size of a bool type variable to the command line terminal.
    std::cout << "\n\nsizeof(bool) = " << sizeof(bool) << ". // number of bytes which a bool type variable occupies";

    // Print the data size of a bool type variable to the file output stream.
    file << "\n\nsizeof(bool) = " << sizeof(bool) << ". // number of bytes which a bool type variable occupies";

    // Print the data size of a char type variable to the command line terminal.
    std::cout << "\n\nsizeof(char) = " << sizeof(char) << ". // number of bytes which a char type variable occupies";

    // Print the data size of a char type variable to the file output stream.
    file << "\n\nsizeof(char) = " << sizeof(char) << ". // number of bytes which a char type variable occupies";

    // Print the data size of an int type variable to the command line terminal.
    std::cout << "\n\nsizeof(int) = " << sizeof(int) << ". // number of bytes which an int type variable occupies";

    // Print the data size of an int type variable to the file output stream.
    file << "\n\nsizeof(int) = " << sizeof(int) << ". // number of bytes which an int type variable occupies";

    // Print the data size of a long type variable to the command line terminal.
    std::cout << "\n\nsizeof(long) = " << sizeof(long) << ". // number of bytes which a long type variable occupies";

    // Print the data size of a long type variable to the file output stream.
    file << "\n\nsizeof(long) = " << sizeof(long) << ". // number of bytes which a long type variable occupies";

    // Print the data size of a float type variable to the command line terminal.
    std::cout << "\n\nsizeof(float) = " << sizeof(float) << ". // number of bytes which a float type variable occupies";

    // Print the data size of a float type variable to the file output stream.
    file << "\n\nsizeof(float) = " << sizeof(float) << ". // number of bytes which a float type variable occupies";

    // Print the data size of a double type variable to the command line terminal.
    std::cout << "\n\nsizeof(double) = " << sizeof(double) << ". // number of bytes which a double type variable occupies";

    // Print the data size of a doudle type variable to the file output stream.
    file << "\n\nsizeof(double) = " << sizeof(double) << ". // number of bytes which a double type variable occupies";

    // Print the data size of a pointer-to-bool type variable to the command line terminal.
    std::cout << "\n\nsizeof(bool *) = " << sizeof(bool *) << ". // number of bytes which a pointer-to-bool type variable occupies";

    // Print the data size of a pointer-to-bool type variable to the file output stream.
    file << "\n\nsizeof(bool *) = " << sizeof(bool *) << ". // number of bytes which a pointer-to-bool type variable occupies";

    // Print the data size of a pointer-to-char type variable to the command line terminal.
    std::cout << "\n\nsizeof(char *) = " << sizeof(char *) << ". // number of bytes which a pointer-to-char type variable occupies";

    // Print the data size of a pointer-to-char type variable to the file output stream.
    file << "\n\nsizeof(char *) = " << sizeof(char *) << ". // number of bytes which a pointer-to-char type variable occupies";

    // Print the data size of a pointer-to-int type variable to the command line terminal.
    std::cout << "\n\nsizeof(int *) = " << sizeof(int *) << ". // number of bytes which a pointer-to-int type variable occupies";

    // Print the data size of a pointer-to-int type variable to the file output stream.
    file << "\n\nsizeof(int *) = " << sizeof(int *) << ". // number of bytes which a pointer-to-int type variable occupies";

    // Print the data size of a pointer-to-long type variable to the command line terminal.
    std::cout << "\n\nsizeof(long *) = " << sizeof(long *) << ". // number of bytes which a pointer-to-long type variable occupies";

    // Print the data size of a pointer-to-long type variable to the file output stream.
    file << "\n\nsizeof(long *) = " << sizeof(long *) << ". // number of bytes which a pointer-to-long type variable occupies";

    // Print the data size of a pointer-to-float type variable to the command line terminal.
    std::cout << "\n\nsizeof(float *) = " << sizeof(float *) << ". // number of bytes which a pointer-to-float type variable occupies";

    // Print the data size of a pointer-to-float type variable to the file output stream.
    file << "\n\nsizeof(float *) = " << sizeof(float *) << ". // number of bytes which a pointer-to-float type variable occupies";

    // Print the data size of a pointer-to-double type variable to the command line terminal.
    std::cout << "\n\nsizeof(double *) = " << sizeof(double *) << ". // number of bytes which a pointer-to-double type variable occupies";

    // Print the data size of a pointer-to-double type variable to the file output stream.
    file << "\n\nsizeof(double *) = " << sizeof(double *) << ". // number of bytes which a pointer-to-double type variable occupies";

    // Print the data size of a pointer-to-pointer-to-bool type variable to the command line terminal.
    std::cout << "\n\nsizeof(bool **) = " << sizeof(bool **) << ". // number of bytes which a pointer-to-pointer-to-bool type variable occupies";

    // Print the data size of a pointer-to-pointer-to-bool type variable to the file output stream.
    file << "\n\nsizeof(bool **) = " << sizeof(bool **) << ". // number of bytes which a pointer-to-pointer-to-bool type variable occupies";

    // Print the data size of a pointer-to-pointer-to-char type variable to the command line terminal.
    std::cout << "\n\nsizeof(char **) = " << sizeof(char **) << ". // number of bytes which a pointer-to-pointer-to-char type variable occupies";

    // Print the data size of a pointer-to-pointer-to-char type variable to the file output stream.
    file << "\n\nsizeof(char **) = " << sizeof(char **) << ". // number of bytes which a pointer-to-pointer-to-char type variable occupies";

    // Print the data size of a pointer-to-pointer-to-int type variable to the command line terminal.
    std::cout << "\n\nsizeof(int **) = " << sizeof(int **) << ". // number of bytes which a pointer-to-pointer-to-int type variable occupies";

    // Print the data size of a pointer-to-pointer-to-int type variable to the file output stream.
    file << "\n\nsizeof(int **) = " << sizeof(int **) << ". // number of bytes which a pointer-to-pointer-to-int type variable occupies";

    // Print the data size of a pointer-to-pointer-to-long type variable to the command line terminal.
    std::cout << "\n\nsizeof(long **) = " << sizeof(long **) << ". // number of bytes which a pointer-to-pointer-to-long type variable occupies";

    // Print the data size of a pointer-to-pointer-to-long type variable to the file output stream.
    file << "\n\nsizeof(long **) = " << sizeof(long **) << ". // number of bytes which a pointer-to-pointer-to-long type variable occupies";

    // Print the data size of a pointer-to-pointer-to-float type variable to the command line terminal.
    std::cout << "\n\nsizeof(float **) = " << sizeof(float **) << ". // number of bytes which a pointer-to-pointer-to-float type variable occupies";

    // Print the data size of a pointer-to-pointer-to-float type variable to the file output stream.
    file << "\n\nsizeof(float **) = " << sizeof(float **) << ". // number of bytes which a pointer-to-pointer-to-float type variable occupies";

    // Print the data size of a pointer-to-pointer-to-double type variable to the command line terminal.
    std::cout << "\n\nsizeof(double **) = " << sizeof(double **) << ". // number of bytes which a pointer-to-pointer-to-double type variable occupies";

    // Print the data size of a pointer-to-pointer-to-double type variable to the file output stream.
    file << "\n\nsizeof(double **) = " << sizeof(double **) << ". // number of bytes which a pointer-to-pointer-to-double type variable occupies";

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    // Print "STEP_0: CREATE A DYNAMIC ARRAY WHICH IS NAMED A AND WHICH IS COMPRISED OF S INT TYPE VALUES." to the command line terminal.
    std::cout << "\n\nSTEP_0: CREATE A DYNAMIC ARRAY WHICH IS NAMED A AND WHICH IS COMPRISED OF S INT TYPE VALUES.";

    // Print "STEP_0: CREATE A DYNAMIC ARRAY WHICH IS NAMED A AND WHICH IS COMRPISED OF S INT TYPE VALUES." to the file output stream.
    file << "\n\nSTEP_0: CREATE A DYNAMIC ARRAY WHICH IS NAMED A AND WHICH IS COMPRISED OF S INT TYPE VALUES.";

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    // Print "Enter a natural number, S, for representing the number of elements to include in an array which is no larger than than {MAXIMUM_S}: " to the command line terminal.
    std::cout << "\n\nEnter a natural number, S, for representing the number of elements to include in an array which is no larger than " << MAXIMUM_S << ": ";

    // Scan the command line terminal for the most recent keyboard input value.
    std::cin >> S;

    // Print "The value which was entered for S is {S}." to the command line terminal.
    std::cout << "\nThe value which was entered for S is " << S << ".";

    // Print "The value which was entered for S is {S}." to the file output stream.
    file << "\n\nThe value which was entered for S is " << S << ".";

    // If S is smaller than 1 or if S is larger than MAXIMUM_S, set S to 10.
    S = ((S < 1) || (S > MAXIMUM_S)) ? 10 : S;  

    // Print "S := {S}. // number of consecutive int-sized chunks of memory to allocate to an array such that the memory address of the first element of that array, A[0], is stored in a pointer-to-int type variable named A" to the command line terminal.
    std::cout << "\n\nS := " << S << ". // number of consecutive int-sized chunks of memory to allocate to an array such that the memory address of the first element of that array, A[0], is stored in a pointer-to-int type variable named A";

    // Print "S := {S}. // number of consecutive int-sized chunks of memory to allocate to an array such that the memory address of the first element of that array, A[0], is stored in a pointer-to-int type variable named A" to the file output stream.
    file << "\n\nS := " << S << ". // number of consecutive int-sized chunks of memory to allocate to an array such that the memory address of the first element of that array, A[0], is stored in a pointer-to-int type variable named A";

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    // Allocate S contiguous int-sized chunks of memory and store the memory address of the first int-sized chunk of memory, A[0]. inside the pointer-to-int type variable named A.
    A = new int [S];

    // Print the program instruction used to generate the dynamic array represented by A to the command line terminal.
    std::cout << "\n\n// Declare a pointer-to-int type variable named A.";
    std::cout << "\nint * A;";
    std::cout << "\n\n// Allocate S contiguous int-sized chunks of memory and store the memory address of the first int-sized chunk of memory, A[0], inside the pointer-to-int type variable named A.";
    std::cout << "\nA = new int [S];"; 

    // Print the program instruction used to generate the dynamic array represented by A to the file output stream.
    file << "\n\n// Declare a pointer-to-int type variable named A.";
    file << "\nint * A;";
    file << "\n\n// Allocate S contiguous int-sized chunks of memory and store the memory address of the first int-sized chunk of memory, A[0], inside the pointer-to-int type variable named A.";
    file << "\nA = new int [S];"; 

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    // Print the contents of A to the command line terminal.
    std::cout << "\n\nA = " << A << ". // memory address of A[0]\n";

    // Print the contents of A to the file output stream.
    file << "\n\nA = " << A << ". // memory address of A[0]\n";

    /**
     * For each element, i, of the array represented by A, 
     * print the contents of the ith element of the array, A[i], 
     * and the memory address of that array element 
     * to the command line terminal and to the file output stream.
     */
    for (i = 0; i < S; i += 1) 
    {
        std::cout << "\nA[" << i << "] = " << A[i] << ". \t\t// &A[" << i << "] = " << &A[i] << ". (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[" << i << "]).";
        file << "\nA[" << i << "] = " << A[i] << ". \t\t// &A[" << i << "] = " << &A[i] << ". (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[" << i << "]).";
    }

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    // Print "STEP_1: RANDOMLY ASSIGN ONE OF THE FIRST T RANDOM NONNEGATIVE INTEGERS TO EACH ELEMENT OF THE ARRAY NAMED A." to the command line terminal.
    std::cout << "\n\nSTEP_1: RANDOMLY ASSIGN ONE OF THE FIRST T RANDOM NONNEGATIVE INTEGERS TO EACH ELEMENT OF THE ARRAY NAMED A.";

    // Print "STEP_1: RANDOMLY ASSIGN ONE OF THE FIRST T RANDOM NONNEGATIVE INTEGERS TO EACH ELEMENT OF THE ARRAY NAMED A." to the file output stream.
    file << "\n\nSTEP_1: RANDOMLY ASSIGN ONE OF THE FIRST T RANDOM NONNEGATIVE INTEGERS TO EACH ELEMENT OF THE ARRAY NAMED A.";

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    // Print "Enter a natural number, T, for representing the number of unique states which each element of the array can store exactly one of which is no larger than {MAXIMUM_T}: " to the command line terminal.
    std::cout << "\n\nEnter a natural number, T, for representing the number of unique states which each element of the array can store exactly one of which is no larger than " << MAXIMUM_T << ": ";

    // Scan the command line terminal for the most recent keyboard input value.
    std::cin >> T;

    // Print "The value which was entered for T is {T}." to the command line terminal.
    std::cout << "\nThe value which was entered for T is " << T << ".";

    // Print "The value which was entered for T is {T}." to the file output stream.
    file << "\n\nThe value which was entered for T is " << T << ".";

    // If T is smaller than 1 or if T is larger than MAXIMUM_T, set T to 100.
    T = ((T < 1) || (T > MAXIMUM_T)) ? 100 : T; 

    // Print "T := {T}. // number of unique states which each element of array A can represent" to the command line terminal.
    std::cout << "\n\nT := " << T << ". // number of unique states which each element of array A can represent";

    // Print "T := {T}. // number of unique states which each element of array A can represent" to the file output stream.
    file << "\n\nT := " << T << ". // number of unique states which each element of array A can represent";

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    // Seed the pseudo random number generator with the integer number of seconds which have elapsed since the Unix Epoch (i.e. midnight of 01_JANUARY_1970).
    srand(time(NULL));

    // Print the command to seed the pseudo random number generator to the command line.
    std::cout << "\n\n// Seed the pseudo random number generator with the integer number of seconds which have elapsed since the Unix Epoch (i.e. midnight of 01_JANUARY_1970).";
    std::cout << "\nsrand(time(NULL));";

    // Print the command to seed the pseudo random number generator to the file output stream.
    file << "\n\n// Seed the pseudo random number generator with the integer number of seconds which have elapsed since the Unix Epoch (i.e. midnight of 01_JANUARY_1970).";
    file << "\nsrand(time(NULL));";

    // For each element, A[i], of the array named A, set A[i] to a randomly generated integer which is no smaller than 0 and no larger than (T - 1).
    for (i = 0; i < S; i += 1) A[i] = rand() % T;

    // Print the command to populate each element of the array named A with a randomly generated integer which is no smaller than 0 and no larger than (T - 1) to the command line terminal.
    std::cout << "\n\n// For each element, A[i], of the array named A, set A[i] to a randomly generated integer which is no smaller than 0 and no larger than (T - 1).";
    std::cout << "\nfor (i = 0; i < S; i += 1) A[i] = rand() % T;";

    // Print the command to populate each element of the array named A with a randomly generated integer which is no smaller than 0 and no larger than (T - 1) to the file output stream.
    file << "\n\n// For each element, A[i], of the array named A, set A[i] to a randomly generated integer which is no smaller than 0 and no larger than (T - 1).";
    file << "\nfor (i = 0; i < S; i += 1) A[i] = rand() % T;";

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    // Print the contents of A to the command line terminal.
    std::cout << "\n\nA = " << A << ". // memory address of A[0]\n";

    // Print the contents of A to the file output stream.
    file << "\n\nA = " << A << ". // memory address of A[0]\n";

    /**
     * For each element, i, of the array represented by A, 
     * print the contents of the ith element of the array, A[i], 
     * and the memory address of that array element 
     * to the command line terminal and to the file output stream.
     */
    for (i = 0; i < S; i += 1) 
    {
        std::cout << "\nA[" << i << "] = " << A[i] << ". \t\t// &A[" << i << "] = " << &A[i] << ". (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[" << i << "]).";
        file << "\nA[" << i << "] = " << A[i] << ". \t\t// &A[" << i << "] = " << &A[i] << ". (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[" << i << "]).";
    }

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    // Print "STEP_2: SORT THE ELEMENT VALUES OF THE ARRAY NAMED A TO BE IN ASCENDING ORDER." to the command line terminal.
    std::cout << "\n\nSTEP_2: SORT THE ELEMENT VALUES OF THE ARRAY NAMED A TO BE IN ASCENDING ORDER.";

    // Print "STEP_2: SORT THE ELEMENT VALUES OF THE ARRAY NAMED A TO BE IN ASCENDING ORDER." to the file output stream.
    file << "\n\nSTEP_2: SORT THE ELEMENT VALUES OF THE ARRAY NAMED A TO BE IN ASCENDING ORDER.";

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    // Sort the integer values stored in array A to be in ascending order using the Bubble Sort algorithm.
    bubble_sort(A, S);

    // Print the command to sort the integer values stored in array A in ascending order to the command line.
    std::cout << "\n\n// Sort the integer values stored in array A to be in ascending order using the Bubble Sort algorithm.";
    std::cout << "\nbubble_sort(A, S);";

    // Print the command to sort the integer values stored in array A in ascending order to the file output stream.
    file << "\n\n// Sort the integer values stored in array A to be in ascending order using the Bubble Sort algorithm.";
    file << "\nbubble_sort(A, S);";

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    // Print the contents of A to the command line terminal.
    std::cout << "\n\nA = " << A << ". // memory address of A[0]\n";

    // Print the contents of A to the file output stream.
    file << "\n\nA = " << A << ". // memory address of A[0]\n";

    /**
     * For each element, i, of the array represented by A, 
     * print the contents of the ith element of the array, A[i], 
     * and the memory address of that array element 
     * to the command line terminal and to the file output stream.
     */
    for (i = 0; i < S; i += 1) 
    {
        std::cout << "\nA[" << i << "] = " << A[i] << ".\t\t// &A[" << i << "] = " << &A[i] << ". (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[" << i << "]).";
        file << "\nA[" << i << "] = " << A[i] << ".\t\t// &A[" << i << "] = " << &A[i] << ". (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[" << i << "]).";
    }

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    // Print "STEP_3: CREATE A DYNAMIC ARRAY WHICH IS NAMED B AND WHICH IS COMPRISED OF T INT TYPE VALUES." to the command line terminal.
    std::cout << "\n\nSTEP_3: CREATE A DYNAMIC ARRAY WHICH IS NAMED B AND WHICH IS COMPRISED OF T INT TYPE VALUES.";

    // Print "STEP_3: CREATE A DYNAMIC ARRAY WHICH IS NAMED B AND WHICH IS COMPRISED OF T INT TYPE VALUES." to the file output stream.
    file << "\n\nSTEP_3: CREATE A DYNAMIC ARRAY WHICH IS NAMED B AND WHICH IS COMPRISED OF T INT TYPE VALUES.";

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    // Allocate T contiguous int-sized chunks of memory and store the memory address of the first int-sized chunk of memory, B[0]. inside the pointer-to-int type variable named B.
    B = new int [T];

    // Print the program instruction used to generate the dynamic array represented by B to the command line terminal.
    std::cout << "\n\n// Declare a pointer-to-int type variable named B.";
    std::cout << "\nint * B;";
    std::cout << "\n\n// Allocate T contiguous int-sized chunks of memory and store the memory address of the first int-sized chunk of memory, B[0], inside the pointer-to-int type variable named B.";
    std::cout << "\nB = new int [T];"; 

    // Print the program instruction used to generate the dynamic array represented by B to the file output stream.
    file << "\n\n// Declare a pointer-to-int type variable named B.";
    file << "\nint * B;";
    file << "\n\n// Allocate T contiguous int-sized chunks of memory and store the memory address of the first int-sized chunk of memory, B[0], inside the pointer-to-int type variable named B.";
    file << "\nB = new int [T];"; 

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    // Print the contents of B to the command line terminal.
    std::cout << "\n\nB = " << B << ". // memory address of B[0]\n";

    // Print the contents of B to the file output stream.
    file << "\n\nB = " << B << ". // memory address of B[0]\n";

    /**
     * For each element, i, of the array represented by B, 
     * print the contents of the ith element of the array, B[i], 
     * and the memory address of that array element 
     * to the command line terminal and to the file output stream.
     */
    for (i = 0; i < T; i += 1) 
    {
        std::cout << "\nB[" << i << "] = " << B[i] << ".\t\t// &B[" << i << "] = " << &B[i] << ". (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[" << i << "]).";
        file << "\nB[" << i << "] = " << B[i] << ".\t\t// &B[" << i << "] = " << &B[i] << ". (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[" << i << "]).";
    }

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    // Print "STEP_4: FOR EACH ELEMENT B[i] OF THE ARRAY NAMED B, STORE THE NUMBER OF TIMES i APPEARS AS AN ELEMENT VALUE IN THE ARRAY NAMED A." to the command line terminal.
    std::cout << "\n\nSTEP_4: FOR EACH ELEMENT B[i] OF THE ARRAY NAMED B, STORE THE NUMBER OF TIMES i APPEARS AS AN ELEMENT VALUE IN THE ARRAY NAMED A.";

    // Print "STEP_4: FOR EACH ELEMENT B[i] OF THE ARRAY NAMED B, STORE THE NUMBER OF TIMES i APPEARS AS AN ELEMENT VALUE IN THE ARRAY NAMED A." to the file output stream.
    file << "\n\nSTEP_4: FOR EACH ELEMENT B[i] OF THE ARRAY NAMED B, STORE THE NUMBER OF TIMES i APPEARS AS AN ELEMENT VALUE IN THE ARRAY NAMED A.";

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    /**
     * For each element, i, of the array represented by B, 
     * store the number of times i appears as an element value in the array represented by A
     * in B[i].
     */ 
    for (i = 0; i < T; i += 1)
    {
        for (k = 0; k < S; k += 1) 
        {
            if (i == A[k]) B[i] += 1;
        }
    }

    // Print the contents of B to the command line terminal.
    std::cout << "\n\nB = " << B << ". // memory address of B[0]\n";

    // Print the contents of B to the file output stream.
    file << "\n\nB = " << B << ". // memory address of B[0]\n";

    /**
     * For each element, i, of the array represented by B, 
     * print the contents of the ith element of the array, B[i], 
     * and the memory address of that array element 
     * to the command line terminal and to the file output stream.
     */
    for (i = 0; i < T; i += 1) 
    {
        std::cout << "\nB[" << i << "] = " << B[i] << ".\t\t// &B[" << i << "] = " << &B[i] << ". (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[" << i << "]).";
        file << "\nB[" << i << "] = " << B[i] << ".\t\t// &B[" << i << "] = " << &B[i] << ". (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[" << i << "]).";
    }

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    // Print "STEP_5: CREATE A DYNAMIC ARRAY WHICH IS NAMED C AND WHICH IS COMPRISED OF T POINTER-TO-CHAR TYPE VALUES." to the command line terminal.
    std::cout << "\n\nSTEP_5: CREATE A DYNAMIC ARRAY WHICH IS NAMED C AND WHICH IS COMPRISED OF T POINTER-TO-CHAR TYPE VALUES.";

    // Print "STEP_5: CREATE A DYNAMIC ARRAY WHICH IS NAMED C AND WHICH IS COMPRISED OF T POINTER-TO-CHAR TYPE VALUES." to the file output stream.
    file << "\n\nSTEP_5: CREATE A DYNAMIC ARRAY WHICH IS NAMED C AND WHICH IS COMPRISED OF T POINTER-TO-CHAR TYPE VALUES.";

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    // Allocate T contiguous pointer-to-char-sized chunks of memory and store the memory address of the first pointer-to-char-sized chunk of memory, C[0], inside the pointer-to-pointer-to-char type variable named C.
    C = new char * [T];

    // C is a two-dimensional array which depicts a histogram (i.e. bar graph) such the length of the ith row is identical to the value stored in B[i].
    for (i = 0; i < T; i += 1) 
    {
        C[i] = new char [B[i]];
        for (k = 0; k < B[i]; k += 1) C[i][k] = 'X';
    }

    // Print the program instruction used to generate the dynamic array represented by C to the command line terminal.
    std::cout << "\n\n// Declare one pointer-to-pointer-to-char type variable.";
    std::cout << "\nchar ** C;";
    std::cout << "\n\n// Allocate T contiguous pointer-to-char-sized chunks of memory and store the memory address of the first pointer-to-char-sized chunk of memory, C[0], inside the pointer-to-pointer-to-char type variable named C.";
    std::cout << "\nC = new char * [T];";
    std::cout << "\n\n// C is a two-dimensional array which depicts a histogram (i.e. bar graph) such the length of the ith row is identical to the value stored in B[i].";
    std::cout << "\nfor (i = 0; i < T; i += 1)";
    std::cout << "\n{";
    std::cout << "\n    C[i] = new char [B[i]];";
    std::cout << "\n    for (k = 0; k < B[i]; k += 1) C[i][k] = 'X';";
    std::cout << "\n}";

    // Print the program instruction used to generate the dynamic array represented by C to the file output stream.
    file << "\n\n// Declare one pointer-to-pointer-to-char type variable.";
    file << "\nchar ** C;";
    file << "\n\n// Allocate T contiguous pointer-to-char-sized chunks of memory and store the memory address of the first pointer-to-char-sized chunk of memory, C[0], inside the pointer-to-pointer-to-char type variable named C.";
    file << "\nC = new char * [T];";
    file << "\n\n// C is a two-dimensional array which depicts a histogram (i.e. bar graph) such the length of the ith row is identical to the value stored in B[i].";
    file << "\nfor (i = 0; i < T; i += 1)";
    file << "\n{";
    file << "\n    C[i] = new char [B[i]];";
    file << "\n    for (k = 0; k < B[i]; k += 1) C[i][k] = 'X';";
    file << "\n}";

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    // Print the contents of C to the command line terminal.
    std::cout << "\n\nC = " << C << ". // memory address of C[0]\n";

    // Print the contents of C to the file output stream.
    file << "\n\nC = " << C << ". // memory address of C[0]\n";

    /**
     * For each element, i, of the array represented by C, 
     * print the contents of the ith element of the array, C[i], 
     * and the memory address of that array element 
     * to the command line terminal and to the file output stream.
     */
    for (i = 0; i < T; i += 1) 
    {
        std::cout << "\nC[" << i << "] = " << C[i] << ".\t\t// &C[" << i << "] = " << &C[i] << ". (memory address of the first byte-sized memory cell comprising the block of 8 contiguous byte-sized memory cells allocated to C[" << i << "]).";
        file << "\nC[" << i << "] = " << C[i] << ".\t\t// &C[" << i << "] = " << &C[i] << ". (memory address of the first byte-sized memory cell comprising the block of 8 contiguous byte-sized memory cells allocated to C[" << i << "]).";
    }

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    // Print "STEP_6: RELEASE MEMORY WHICH WAS ALLOCATED TO THE DYNAMIC ARRAYS NAMED A, B, AND C." to the command line terminal.
    std::cout << "\n\nSTEP_6: RELEASE MEMORY WHICH WAS ALLOCATED TO THE DYNAMIC ARRAYS NAMED A, B, AND C.";

    // Print "STEP_6: RELEASE MEMORY WHICH WAS ALLOCATED TO THE DYNAMIC ARRAYS NAMED A, B, AND C." to the file output stream.
    file << "\n\nSTEP_6: RELEASE MEMORY WHICH WAS ALLOCATED TO THE DYNAMIC ARRAYS NAMED A, B, AND C.";

    // Print a horizontal line to the command line terminal.
    std::cout << "\n\n--------------------------------";

    // Print a horizontal line to the command line terminal.
    file << "\n\n--------------------------------";

    /**
     * Note that, unlike a static array, a dynamic array is instantiated during program runtime instead of during program compile time.
     * (A static array is assigned memory during program compilation while a dynamic array is assigned memory during program runtime).
     * At compile time, the computer does not know how much memory space to allocate to a dynamic array because the number of elements
     * in that array may vary and is not specified in the program source code.
     */

    // De-allocate memory which was assigned to the dynamically-allocated array of S int type values
    delete [] A;

    // Print the command to de-allocate memory which was assigned to the dynamically-allocated array of S int type values to the command line terminal.
    std::cout << "\n\n// De-allocate memory which was assigned to the dynamically-allocated array of S int type values.";
    std::cout << "\ndelete [] A; // Free up S contiguous int-sized chunks of memory which were assigned to the dynamic array named A.";

    // Print the command to de-allocate memory which was assigned to the dynamically-allocated array of S int type values to the file output stream.
    file << "\n\n// De-allocate memory which was assigned to the dynamically-allocated array of S int type values.";
    file << "\ndelete [] A; // Free up S contiguous int-sized chunks of memory which were assigned to the dynamic array named A.";

    // De-allocate memory which was assigned to the dynamically-allocated array of T int type values.
    delete [] B;

    // Print the command to de-allocate memory which was assigned to the dynamically-allocated array of T int type values to the command line terminal.
    std::cout << "\n\nDe-allocate memory which was assigned to the dynamically-allocated array of T int type values.";
    std::cout << "\ndelete [] B; // Free up T contiguous int-sized chunks of memory which were assigned to the dynamic array named B.";

    // Print the command to de-allocate memory which was assigned to the dynamically-allocated array of T int type values to the file output stream.
    file << "\n\nDe-allocate memory which was assigned to the dynamically-allocated array of T int type values.";
    file << "\ndelete [] B; // Free up T contiguous int-sized chunks of memory which were assigned to the dynamic array named B.";

    // De-allocate memory which was assigned to the dynamically-allocated array of T pointer-to-char type values.
    for (i = 0; i < T; i += 1) delete [] C[i];
    delete [] C;

    // Print the command to de-allocate memory which was assigned to the dynamically-allocated array of T pointer-to-char type values to the command line terminal.
    std::cout << "\n\n// De-allocate memory which was assigned to the dynamically-allocated array of T pointer-to-char type values.";
    std::cout << "\nfor (i = 0; i < T; i += 1) delete [] C[i]; // Free up B[i] char-sized chunks of memory which were assigned to the dynamic array named C[i].";
    std::cout << "\ndelete [] C; // Free up T contiguous pointer-to-char-sized chunks of memory which were assigned to the dynamic array named C.";

    // Print the command to de-allocate memory which was assigned to the dynamically-allocated array of T pointer-to-char type values to the file output stream.
    file << "\n\n// De-allocate memory which was assigned to the dynamically-allocated array of T pointer-to-char type values.";
    file << "\nfor (i = 0; i < T; i += 1) delete [] C[i]; // Free up B[i] char-sized chunks of memory which were assigned to the dynamic array named C[i].";
    file << "\ndelete [] C; // Free up T contiguous pointer-to-char-sized chunks of memory which were assigned to the dynamic array named C.";

    // Print a closing message to the command line terminal.
    std::cout << "\n\n--------------------------------";
    std::cout << "\nEnd Of Program";
    std::cout << "\n--------------------------------\n\n";

    // Print a closing message to the file output stream.
    file << "\n\n--------------------------------";
    file << "\nEnd Of Program";
    file << "\n--------------------------------";

    // Close the file output stream.
    file.close();

    // Exit the program.
    return 0;
}

SAMPLE_PROGRAM_OUTPUT


The text in the preformatted text box below was generated by one use case of the C++ program featured in this computer programming tutorial web page.

plain-text_file: https://raw.githubusercontent.com/karlinarayberinger/KARLINA_OBJECT_summer_2023_starter_pack/main/arrays_output.txt


--------------------------------
Start Of Program
--------------------------------

The following statements describe the data capacities of various primitive C++ data types:

sizeof(bool) = 1. // number of bytes which a bool type variable occupies

sizeof(char) = 1. // number of bytes which a char type variable occupies

sizeof(int) = 4. // number of bytes which an int type variable occupies

sizeof(long) = 8. // number of bytes which a long type variable occupies

sizeof(float) = 4. // number of bytes which a float type variable occupies

sizeof(double) = 8. // number of bytes which a double type variable occupies

sizeof(bool *) = 8. // number of bytes which a pointer-to-bool type variable occupies

sizeof(char *) = 8. // number of bytes which a pointer-to-char type variable occupies

sizeof(int *) = 8. // number of bytes which a pointer-to-int type variable occupies

sizeof(long *) = 8. // number of bytes which a pointer-to-long type variable occupies

sizeof(float *) = 8. // number of bytes which a pointer-to-float type variable occupies

sizeof(double *) = 8. // number of bytes which a pointer-to-double type variable occupies

sizeof(bool **) = 8. // number of bytes which a pointer-to-pointer-to-bool type variable occupies

sizeof(char **) = 8. // number of bytes which a pointer-to-pointer-to-char type variable occupies

sizeof(int **) = 8. // number of bytes which a pointer-to-pointer-to-int type variable occupies

sizeof(long **) = 8. // number of bytes which a pointer-to-pointer-to-long type variable occupies

sizeof(float **) = 8. // number of bytes which a pointer-to-pointer-to-float type variable occupies

sizeof(double **) = 8. // number of bytes which a pointer-to-pointer-to-double type variable occupies

--------------------------------

STEP_0: CREATE A DYNAMIC ARRAY WHICH IS NAMED A AND WHICH IS COMPRISED OF S INT TYPE VALUES.

--------------------------------

The value which was entered for S is 100.

S := 100. // number of consecutive int-sized chunks of memory to allocate to an array such that the memory address of the first element of that array, A[0], is stored in a pointer-to-int type variable named A

--------------------------------

// Declare a pointer-to-int type variable named A.
int * A;

// Allocate S contiguous int-sized chunks of memory and store the memory address of the first int-sized chunk of memory, A[0], inside the pointer-to-int type variable named A.
A = new int [S];

--------------------------------

A = 0x5607d37868c0. // memory address of A[0]

A[0] = 0. 		// &A[0] = 0x5607d37868c0. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[0]).
A[1] = 0. 		// &A[1] = 0x5607d37868c4. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[1]).
A[2] = 0. 		// &A[2] = 0x5607d37868c8. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[2]).
A[3] = 0. 		// &A[3] = 0x5607d37868cc. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[3]).
A[4] = 0. 		// &A[4] = 0x5607d37868d0. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[4]).
A[5] = 0. 		// &A[5] = 0x5607d37868d4. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[5]).
A[6] = 0. 		// &A[6] = 0x5607d37868d8. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[6]).
A[7] = 0. 		// &A[7] = 0x5607d37868dc. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[7]).
A[8] = 0. 		// &A[8] = 0x5607d37868e0. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[8]).
A[9] = 0. 		// &A[9] = 0x5607d37868e4. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[9]).
A[10] = 0. 		// &A[10] = 0x5607d37868e8. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[10]).
A[11] = 0. 		// &A[11] = 0x5607d37868ec. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[11]).
A[12] = 0. 		// &A[12] = 0x5607d37868f0. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[12]).
A[13] = 0. 		// &A[13] = 0x5607d37868f4. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[13]).
A[14] = 0. 		// &A[14] = 0x5607d37868f8. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[14]).
A[15] = 0. 		// &A[15] = 0x5607d37868fc. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[15]).
A[16] = 0. 		// &A[16] = 0x5607d3786900. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[16]).
A[17] = 0. 		// &A[17] = 0x5607d3786904. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[17]).
A[18] = 0. 		// &A[18] = 0x5607d3786908. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[18]).
A[19] = 0. 		// &A[19] = 0x5607d378690c. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[19]).
A[20] = 0. 		// &A[20] = 0x5607d3786910. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[20]).
A[21] = 0. 		// &A[21] = 0x5607d3786914. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[21]).
A[22] = 0. 		// &A[22] = 0x5607d3786918. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[22]).
A[23] = 0. 		// &A[23] = 0x5607d378691c. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[23]).
A[24] = 0. 		// &A[24] = 0x5607d3786920. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[24]).
A[25] = 0. 		// &A[25] = 0x5607d3786924. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[25]).
A[26] = 0. 		// &A[26] = 0x5607d3786928. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[26]).
A[27] = 0. 		// &A[27] = 0x5607d378692c. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[27]).
A[28] = 0. 		// &A[28] = 0x5607d3786930. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[28]).
A[29] = 0. 		// &A[29] = 0x5607d3786934. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[29]).
A[30] = 0. 		// &A[30] = 0x5607d3786938. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[30]).
A[31] = 0. 		// &A[31] = 0x5607d378693c. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[31]).
A[32] = 0. 		// &A[32] = 0x5607d3786940. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[32]).
A[33] = 0. 		// &A[33] = 0x5607d3786944. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[33]).
A[34] = 0. 		// &A[34] = 0x5607d3786948. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[34]).
A[35] = 0. 		// &A[35] = 0x5607d378694c. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[35]).
A[36] = 0. 		// &A[36] = 0x5607d3786950. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[36]).
A[37] = 0. 		// &A[37] = 0x5607d3786954. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[37]).
A[38] = 0. 		// &A[38] = 0x5607d3786958. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[38]).
A[39] = 0. 		// &A[39] = 0x5607d378695c. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[39]).
A[40] = 0. 		// &A[40] = 0x5607d3786960. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[40]).
A[41] = 0. 		// &A[41] = 0x5607d3786964. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[41]).
A[42] = 0. 		// &A[42] = 0x5607d3786968. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[42]).
A[43] = 0. 		// &A[43] = 0x5607d378696c. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[43]).
A[44] = 0. 		// &A[44] = 0x5607d3786970. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[44]).
A[45] = 0. 		// &A[45] = 0x5607d3786974. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[45]).
A[46] = 0. 		// &A[46] = 0x5607d3786978. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[46]).
A[47] = 0. 		// &A[47] = 0x5607d378697c. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[47]).
A[48] = 0. 		// &A[48] = 0x5607d3786980. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[48]).
A[49] = 0. 		// &A[49] = 0x5607d3786984. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[49]).
A[50] = 0. 		// &A[50] = 0x5607d3786988. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[50]).
A[51] = 0. 		// &A[51] = 0x5607d378698c. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[51]).
A[52] = 0. 		// &A[52] = 0x5607d3786990. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[52]).
A[53] = 0. 		// &A[53] = 0x5607d3786994. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[53]).
A[54] = 0. 		// &A[54] = 0x5607d3786998. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[54]).
A[55] = 0. 		// &A[55] = 0x5607d378699c. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[55]).
A[56] = 0. 		// &A[56] = 0x5607d37869a0. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[56]).
A[57] = 0. 		// &A[57] = 0x5607d37869a4. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[57]).
A[58] = 0. 		// &A[58] = 0x5607d37869a8. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[58]).
A[59] = 0. 		// &A[59] = 0x5607d37869ac. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[59]).
A[60] = 0. 		// &A[60] = 0x5607d37869b0. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[60]).
A[61] = 0. 		// &A[61] = 0x5607d37869b4. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[61]).
A[62] = 0. 		// &A[62] = 0x5607d37869b8. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[62]).
A[63] = 0. 		// &A[63] = 0x5607d37869bc. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[63]).
A[64] = 0. 		// &A[64] = 0x5607d37869c0. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[64]).
A[65] = 0. 		// &A[65] = 0x5607d37869c4. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[65]).
A[66] = 0. 		// &A[66] = 0x5607d37869c8. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[66]).
A[67] = 0. 		// &A[67] = 0x5607d37869cc. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[67]).
A[68] = 0. 		// &A[68] = 0x5607d37869d0. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[68]).
A[69] = 0. 		// &A[69] = 0x5607d37869d4. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[69]).
A[70] = 0. 		// &A[70] = 0x5607d37869d8. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[70]).
A[71] = 0. 		// &A[71] = 0x5607d37869dc. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[71]).
A[72] = 0. 		// &A[72] = 0x5607d37869e0. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[72]).
A[73] = 0. 		// &A[73] = 0x5607d37869e4. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[73]).
A[74] = 0. 		// &A[74] = 0x5607d37869e8. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[74]).
A[75] = 0. 		// &A[75] = 0x5607d37869ec. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[75]).
A[76] = 0. 		// &A[76] = 0x5607d37869f0. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[76]).
A[77] = 0. 		// &A[77] = 0x5607d37869f4. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[77]).
A[78] = 0. 		// &A[78] = 0x5607d37869f8. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[78]).
A[79] = 0. 		// &A[79] = 0x5607d37869fc. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[79]).
A[80] = 0. 		// &A[80] = 0x5607d3786a00. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[80]).
A[81] = 0. 		// &A[81] = 0x5607d3786a04. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[81]).
A[82] = 0. 		// &A[82] = 0x5607d3786a08. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[82]).
A[83] = 0. 		// &A[83] = 0x5607d3786a0c. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[83]).
A[84] = 0. 		// &A[84] = 0x5607d3786a10. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[84]).
A[85] = 0. 		// &A[85] = 0x5607d3786a14. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[85]).
A[86] = 0. 		// &A[86] = 0x5607d3786a18. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[86]).
A[87] = 0. 		// &A[87] = 0x5607d3786a1c. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[87]).
A[88] = 0. 		// &A[88] = 0x5607d3786a20. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[88]).
A[89] = 0. 		// &A[89] = 0x5607d3786a24. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[89]).
A[90] = 0. 		// &A[90] = 0x5607d3786a28. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[90]).
A[91] = 0. 		// &A[91] = 0x5607d3786a2c. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[91]).
A[92] = 0. 		// &A[92] = 0x5607d3786a30. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[92]).
A[93] = 0. 		// &A[93] = 0x5607d3786a34. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[93]).
A[94] = 0. 		// &A[94] = 0x5607d3786a38. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[94]).
A[95] = 0. 		// &A[95] = 0x5607d3786a3c. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[95]).
A[96] = 0. 		// &A[96] = 0x5607d3786a40. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[96]).
A[97] = 0. 		// &A[97] = 0x5607d3786a44. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[97]).
A[98] = 0. 		// &A[98] = 0x5607d3786a48. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[98]).
A[99] = 0. 		// &A[99] = 0x5607d3786a4c. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to A[99]).

--------------------------------

STEP_1: RANDOMLY ASSIGN ONE OF THE FIRST T RANDOM NONNEGATIVE INTEGERS TO EACH ELEMENT OF THE ARRAY NAMED A.

--------------------------------

The value which was entered for T is 10.

T := 10. // number of unique states which each element of array A can represent

--------------------------------

// Seed the pseudo random number generator with the integer number of seconds which have elapsed since the Unix Epoch (i.e. midnight of 01_JANUARY_1970).
srand(time(NULL));

// For each element, A[i], of the array named A, set A[i] to a randomly generated integer which is no smaller than 0 and no larger than (T - 1).
for (i = 0; i < S; i += 1) A[i] = rand() % T;

--------------------------------

A = 0x5607d37868c0. // memory address of A[0]

A[0] = 1. 		// &A[0] = 0x5607d37868c0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[0]).
A[1] = 6. 		// &A[1] = 0x5607d37868c4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[1]).
A[2] = 2. 		// &A[2] = 0x5607d37868c8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[2]).
A[3] = 8. 		// &A[3] = 0x5607d37868cc. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[3]).
A[4] = 8. 		// &A[4] = 0x5607d37868d0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[4]).
A[5] = 3. 		// &A[5] = 0x5607d37868d4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[5]).
A[6] = 1. 		// &A[6] = 0x5607d37868d8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[6]).
A[7] = 8. 		// &A[7] = 0x5607d37868dc. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[7]).
A[8] = 3. 		// &A[8] = 0x5607d37868e0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[8]).
A[9] = 3. 		// &A[9] = 0x5607d37868e4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[9]).
A[10] = 4. 		// &A[10] = 0x5607d37868e8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[10]).
A[11] = 7. 		// &A[11] = 0x5607d37868ec. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[11]).
A[12] = 4. 		// &A[12] = 0x5607d37868f0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[12]).
A[13] = 7. 		// &A[13] = 0x5607d37868f4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[13]).
A[14] = 0. 		// &A[14] = 0x5607d37868f8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[14]).
A[15] = 1. 		// &A[15] = 0x5607d37868fc. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[15]).
A[16] = 8. 		// &A[16] = 0x5607d3786900. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[16]).
A[17] = 7. 		// &A[17] = 0x5607d3786904. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[17]).
A[18] = 2. 		// &A[18] = 0x5607d3786908. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[18]).
A[19] = 5. 		// &A[19] = 0x5607d378690c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[19]).
A[20] = 7. 		// &A[20] = 0x5607d3786910. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[20]).
A[21] = 5. 		// &A[21] = 0x5607d3786914. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[21]).
A[22] = 9. 		// &A[22] = 0x5607d3786918. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[22]).
A[23] = 1. 		// &A[23] = 0x5607d378691c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[23]).
A[24] = 8. 		// &A[24] = 0x5607d3786920. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[24]).
A[25] = 0. 		// &A[25] = 0x5607d3786924. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[25]).
A[26] = 0. 		// &A[26] = 0x5607d3786928. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[26]).
A[27] = 9. 		// &A[27] = 0x5607d378692c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[27]).
A[28] = 1. 		// &A[28] = 0x5607d3786930. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[28]).
A[29] = 2. 		// &A[29] = 0x5607d3786934. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[29]).
A[30] = 9. 		// &A[30] = 0x5607d3786938. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[30]).
A[31] = 2. 		// &A[31] = 0x5607d378693c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[31]).
A[32] = 8. 		// &A[32] = 0x5607d3786940. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[32]).
A[33] = 3. 		// &A[33] = 0x5607d3786944. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[33]).
A[34] = 0. 		// &A[34] = 0x5607d3786948. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[34]).
A[35] = 8. 		// &A[35] = 0x5607d378694c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[35]).
A[36] = 7. 		// &A[36] = 0x5607d3786950. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[36]).
A[37] = 1. 		// &A[37] = 0x5607d3786954. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[37]).
A[38] = 7. 		// &A[38] = 0x5607d3786958. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[38]).
A[39] = 2. 		// &A[39] = 0x5607d378695c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[39]).
A[40] = 7. 		// &A[40] = 0x5607d3786960. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[40]).
A[41] = 1. 		// &A[41] = 0x5607d3786964. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[41]).
A[42] = 1. 		// &A[42] = 0x5607d3786968. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[42]).
A[43] = 1. 		// &A[43] = 0x5607d378696c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[43]).
A[44] = 0. 		// &A[44] = 0x5607d3786970. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[44]).
A[45] = 4. 		// &A[45] = 0x5607d3786974. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[45]).
A[46] = 4. 		// &A[46] = 0x5607d3786978. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[46]).
A[47] = 0. 		// &A[47] = 0x5607d378697c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[47]).
A[48] = 1. 		// &A[48] = 0x5607d3786980. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[48]).
A[49] = 6. 		// &A[49] = 0x5607d3786984. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[49]).
A[50] = 5. 		// &A[50] = 0x5607d3786988. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[50]).
A[51] = 0. 		// &A[51] = 0x5607d378698c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[51]).
A[52] = 4. 		// &A[52] = 0x5607d3786990. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[52]).
A[53] = 6. 		// &A[53] = 0x5607d3786994. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[53]).
A[54] = 1. 		// &A[54] = 0x5607d3786998. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[54]).
A[55] = 2. 		// &A[55] = 0x5607d378699c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[55]).
A[56] = 7. 		// &A[56] = 0x5607d37869a0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[56]).
A[57] = 1. 		// &A[57] = 0x5607d37869a4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[57]).
A[58] = 1. 		// &A[58] = 0x5607d37869a8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[58]).
A[59] = 0. 		// &A[59] = 0x5607d37869ac. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[59]).
A[60] = 3. 		// &A[60] = 0x5607d37869b0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[60]).
A[61] = 3. 		// &A[61] = 0x5607d37869b4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[61]).
A[62] = 2. 		// &A[62] = 0x5607d37869b8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[62]).
A[63] = 4. 		// &A[63] = 0x5607d37869bc. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[63]).
A[64] = 6. 		// &A[64] = 0x5607d37869c0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[64]).
A[65] = 4. 		// &A[65] = 0x5607d37869c4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[65]).
A[66] = 4. 		// &A[66] = 0x5607d37869c8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[66]).
A[67] = 5. 		// &A[67] = 0x5607d37869cc. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[67]).
A[68] = 8. 		// &A[68] = 0x5607d37869d0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[68]).
A[69] = 1. 		// &A[69] = 0x5607d37869d4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[69]).
A[70] = 9. 		// &A[70] = 0x5607d37869d8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[70]).
A[71] = 5. 		// &A[71] = 0x5607d37869dc. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[71]).
A[72] = 4. 		// &A[72] = 0x5607d37869e0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[72]).
A[73] = 1. 		// &A[73] = 0x5607d37869e4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[73]).
A[74] = 8. 		// &A[74] = 0x5607d37869e8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[74]).
A[75] = 6. 		// &A[75] = 0x5607d37869ec. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[75]).
A[76] = 7. 		// &A[76] = 0x5607d37869f0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[76]).
A[77] = 2. 		// &A[77] = 0x5607d37869f4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[77]).
A[78] = 6. 		// &A[78] = 0x5607d37869f8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[78]).
A[79] = 0. 		// &A[79] = 0x5607d37869fc. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[79]).
A[80] = 1. 		// &A[80] = 0x5607d3786a00. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[80]).
A[81] = 4. 		// &A[81] = 0x5607d3786a04. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[81]).
A[82] = 0. 		// &A[82] = 0x5607d3786a08. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[82]).
A[83] = 7. 		// &A[83] = 0x5607d3786a0c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[83]).
A[84] = 2. 		// &A[84] = 0x5607d3786a10. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[84]).
A[85] = 1. 		// &A[85] = 0x5607d3786a14. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[85]).
A[86] = 9. 		// &A[86] = 0x5607d3786a18. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[86]).
A[87] = 9. 		// &A[87] = 0x5607d3786a1c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[87]).
A[88] = 5. 		// &A[88] = 0x5607d3786a20. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[88]).
A[89] = 2. 		// &A[89] = 0x5607d3786a24. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[89]).
A[90] = 9. 		// &A[90] = 0x5607d3786a28. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[90]).
A[91] = 0. 		// &A[91] = 0x5607d3786a2c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[91]).
A[92] = 5. 		// &A[92] = 0x5607d3786a30. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[92]).
A[93] = 3. 		// &A[93] = 0x5607d3786a34. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[93]).
A[94] = 6. 		// &A[94] = 0x5607d3786a38. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[94]).
A[95] = 2. 		// &A[95] = 0x5607d3786a3c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[95]).
A[96] = 8. 		// &A[96] = 0x5607d3786a40. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[96]).
A[97] = 1. 		// &A[97] = 0x5607d3786a44. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[97]).
A[98] = 7. 		// &A[98] = 0x5607d3786a48. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[98]).
A[99] = 6. 		// &A[99] = 0x5607d3786a4c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[99]).

--------------------------------

STEP_2: SORT THE ELEMENT VALUES OF THE ARRAY NAMED A TO BE IN ASCENDING ORDER.

--------------------------------

// Sort the integer values stored in array A to be in ascending order using the Bubble Sort algorithm.
bubble_sort(A, S);

--------------------------------

A = 0x5607d37868c0. // memory address of A[0]

A[0] = 0.		// &A[0] = 0x5607d37868c0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[0]).
A[1] = 0.		// &A[1] = 0x5607d37868c4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[1]).
A[2] = 0.		// &A[2] = 0x5607d37868c8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[2]).
A[3] = 0.		// &A[3] = 0x5607d37868cc. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[3]).
A[4] = 0.		// &A[4] = 0x5607d37868d0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[4]).
A[5] = 0.		// &A[5] = 0x5607d37868d4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[5]).
A[6] = 0.		// &A[6] = 0x5607d37868d8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[6]).
A[7] = 0.		// &A[7] = 0x5607d37868dc. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[7]).
A[8] = 0.		// &A[8] = 0x5607d37868e0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[8]).
A[9] = 0.		// &A[9] = 0x5607d37868e4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[9]).
A[10] = 0.		// &A[10] = 0x5607d37868e8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[10]).
A[11] = 1.		// &A[11] = 0x5607d37868ec. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[11]).
A[12] = 1.		// &A[12] = 0x5607d37868f0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[12]).
A[13] = 1.		// &A[13] = 0x5607d37868f4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[13]).
A[14] = 1.		// &A[14] = 0x5607d37868f8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[14]).
A[15] = 1.		// &A[15] = 0x5607d37868fc. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[15]).
A[16] = 1.		// &A[16] = 0x5607d3786900. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[16]).
A[17] = 1.		// &A[17] = 0x5607d3786904. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[17]).
A[18] = 1.		// &A[18] = 0x5607d3786908. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[18]).
A[19] = 1.		// &A[19] = 0x5607d378690c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[19]).
A[20] = 1.		// &A[20] = 0x5607d3786910. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[20]).
A[21] = 1.		// &A[21] = 0x5607d3786914. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[21]).
A[22] = 1.		// &A[22] = 0x5607d3786918. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[22]).
A[23] = 1.		// &A[23] = 0x5607d378691c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[23]).
A[24] = 1.		// &A[24] = 0x5607d3786920. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[24]).
A[25] = 1.		// &A[25] = 0x5607d3786924. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[25]).
A[26] = 1.		// &A[26] = 0x5607d3786928. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[26]).
A[27] = 1.		// &A[27] = 0x5607d378692c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[27]).
A[28] = 1.		// &A[28] = 0x5607d3786930. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[28]).
A[29] = 2.		// &A[29] = 0x5607d3786934. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[29]).
A[30] = 2.		// &A[30] = 0x5607d3786938. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[30]).
A[31] = 2.		// &A[31] = 0x5607d378693c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[31]).
A[32] = 2.		// &A[32] = 0x5607d3786940. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[32]).
A[33] = 2.		// &A[33] = 0x5607d3786944. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[33]).
A[34] = 2.		// &A[34] = 0x5607d3786948. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[34]).
A[35] = 2.		// &A[35] = 0x5607d378694c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[35]).
A[36] = 2.		// &A[36] = 0x5607d3786950. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[36]).
A[37] = 2.		// &A[37] = 0x5607d3786954. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[37]).
A[38] = 2.		// &A[38] = 0x5607d3786958. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[38]).
A[39] = 2.		// &A[39] = 0x5607d378695c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[39]).
A[40] = 3.		// &A[40] = 0x5607d3786960. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[40]).
A[41] = 3.		// &A[41] = 0x5607d3786964. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[41]).
A[42] = 3.		// &A[42] = 0x5607d3786968. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[42]).
A[43] = 3.		// &A[43] = 0x5607d378696c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[43]).
A[44] = 3.		// &A[44] = 0x5607d3786970. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[44]).
A[45] = 3.		// &A[45] = 0x5607d3786974. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[45]).
A[46] = 3.		// &A[46] = 0x5607d3786978. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[46]).
A[47] = 4.		// &A[47] = 0x5607d378697c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[47]).
A[48] = 4.		// &A[48] = 0x5607d3786980. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[48]).
A[49] = 4.		// &A[49] = 0x5607d3786984. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[49]).
A[50] = 4.		// &A[50] = 0x5607d3786988. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[50]).
A[51] = 4.		// &A[51] = 0x5607d378698c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[51]).
A[52] = 4.		// &A[52] = 0x5607d3786990. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[52]).
A[53] = 4.		// &A[53] = 0x5607d3786994. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[53]).
A[54] = 4.		// &A[54] = 0x5607d3786998. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[54]).
A[55] = 4.		// &A[55] = 0x5607d378699c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[55]).
A[56] = 4.		// &A[56] = 0x5607d37869a0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[56]).
A[57] = 5.		// &A[57] = 0x5607d37869a4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[57]).
A[58] = 5.		// &A[58] = 0x5607d37869a8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[58]).
A[59] = 5.		// &A[59] = 0x5607d37869ac. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[59]).
A[60] = 5.		// &A[60] = 0x5607d37869b0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[60]).
A[61] = 5.		// &A[61] = 0x5607d37869b4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[61]).
A[62] = 5.		// &A[62] = 0x5607d37869b8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[62]).
A[63] = 5.		// &A[63] = 0x5607d37869bc. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[63]).
A[64] = 6.		// &A[64] = 0x5607d37869c0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[64]).
A[65] = 6.		// &A[65] = 0x5607d37869c4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[65]).
A[66] = 6.		// &A[66] = 0x5607d37869c8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[66]).
A[67] = 6.		// &A[67] = 0x5607d37869cc. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[67]).
A[68] = 6.		// &A[68] = 0x5607d37869d0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[68]).
A[69] = 6.		// &A[69] = 0x5607d37869d4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[69]).
A[70] = 6.		// &A[70] = 0x5607d37869d8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[70]).
A[71] = 6.		// &A[71] = 0x5607d37869dc. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[71]).
A[72] = 7.		// &A[72] = 0x5607d37869e0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[72]).
A[73] = 7.		// &A[73] = 0x5607d37869e4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[73]).
A[74] = 7.		// &A[74] = 0x5607d37869e8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[74]).
A[75] = 7.		// &A[75] = 0x5607d37869ec. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[75]).
A[76] = 7.		// &A[76] = 0x5607d37869f0. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[76]).
A[77] = 7.		// &A[77] = 0x5607d37869f4. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[77]).
A[78] = 7.		// &A[78] = 0x5607d37869f8. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[78]).
A[79] = 7.		// &A[79] = 0x5607d37869fc. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[79]).
A[80] = 7.		// &A[80] = 0x5607d3786a00. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[80]).
A[81] = 7.		// &A[81] = 0x5607d3786a04. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[81]).
A[82] = 7.		// &A[82] = 0x5607d3786a08. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[82]).
A[83] = 8.		// &A[83] = 0x5607d3786a0c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[83]).
A[84] = 8.		// &A[84] = 0x5607d3786a10. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[84]).
A[85] = 8.		// &A[85] = 0x5607d3786a14. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[85]).
A[86] = 8.		// &A[86] = 0x5607d3786a18. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[86]).
A[87] = 8.		// &A[87] = 0x5607d3786a1c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[87]).
A[88] = 8.		// &A[88] = 0x5607d3786a20. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[88]).
A[89] = 8.		// &A[89] = 0x5607d3786a24. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[89]).
A[90] = 8.		// &A[90] = 0x5607d3786a28. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[90]).
A[91] = 8.		// &A[91] = 0x5607d3786a2c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[91]).
A[92] = 8.		// &A[92] = 0x5607d3786a30. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[92]).
A[93] = 9.		// &A[93] = 0x5607d3786a34. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[93]).
A[94] = 9.		// &A[94] = 0x5607d3786a38. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[94]).
A[95] = 9.		// &A[95] = 0x5607d3786a3c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[95]).
A[96] = 9.		// &A[96] = 0x5607d3786a40. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[96]).
A[97] = 9.		// &A[97] = 0x5607d3786a44. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[97]).
A[98] = 9.		// &A[98] = 0x5607d3786a48. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[98]).
A[99] = 9.		// &A[99] = 0x5607d3786a4c. (memory address of the first memory cell comprising the block of 4 contiguous memory cells allocated to A[99]).

--------------------------------

STEP_3: CREATE A DYNAMIC ARRAY WHICH IS NAMED B AND WHICH IS COMPRISED OF T INT TYPE VALUES.

--------------------------------

// Declare a pointer-to-int type variable named B.
int * B;

// Allocate T contiguous int-sized chunks of memory and store the memory address of the first int-sized chunk of memory, B[0], inside the pointer-to-int type variable named B.
B = new int [T];

--------------------------------

B = 0x5607d3786a60. // memory address of B[0]

B[0] = 0.		// &B[0] = 0x5607d3786a60. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[0]).
B[1] = 0.		// &B[1] = 0x5607d3786a64. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[1]).
B[2] = 0.		// &B[2] = 0x5607d3786a68. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[2]).
B[3] = 0.		// &B[3] = 0x5607d3786a6c. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[3]).
B[4] = 0.		// &B[4] = 0x5607d3786a70. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[4]).
B[5] = 0.		// &B[5] = 0x5607d3786a74. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[5]).
B[6] = 0.		// &B[6] = 0x5607d3786a78. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[6]).
B[7] = 0.		// &B[7] = 0x5607d3786a7c. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[7]).
B[8] = 0.		// &B[8] = 0x5607d3786a80. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[8]).
B[9] = 0.		// &B[9] = 0x5607d3786a84. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[9]).

--------------------------------

STEP_4: FOR EACH ELEMENT B[i] OF THE ARRAY NAMED B, STORE THE NUMBER OF TIMES i APPEARS AS AN ELEMENT VALUE IN THE ARRAY NAMED A.

--------------------------------

B = 0x5607d3786a60. // memory address of B[0]

B[0] = 11.		// &B[0] = 0x5607d3786a60. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[0]).
B[1] = 18.		// &B[1] = 0x5607d3786a64. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[1]).
B[2] = 11.		// &B[2] = 0x5607d3786a68. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[2]).
B[3] = 7.		// &B[3] = 0x5607d3786a6c. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[3]).
B[4] = 10.		// &B[4] = 0x5607d3786a70. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[4]).
B[5] = 7.		// &B[5] = 0x5607d3786a74. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[5]).
B[6] = 8.		// &B[6] = 0x5607d3786a78. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[6]).
B[7] = 11.		// &B[7] = 0x5607d3786a7c. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[7]).
B[8] = 10.		// &B[8] = 0x5607d3786a80. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[8]).
B[9] = 7.		// &B[9] = 0x5607d3786a84. (memory address of the first byte-sized memory cell comprising the block of 4 contiguous byte-sized memory cells allocated to B[9]).

--------------------------------

STEP_5: CREATE A DYNAMIC ARRAY WHICH IS NAMED C AND WHICH IS COMPRISED OF T POINTER-TO-CHAR TYPE VALUES.

--------------------------------

// Declare one pointer-to-pointer-to-char type variable.
char ** C;

// Allocate T contiguous pointer-to-char-sized chunks of memory and store the memory address of the first pointer-to-char-sized chunk of memory, C[0], inside the pointer-to-pointer-to-char type variable named C.
C = new char * [T];

// C is a two-dimensional array which depicts a histogram (i.e. bar graph) such the length of the ith row is identical to the value stored in B[i].
for (i = 0; i < T; i += 1)
{
    C[i] = new char [B[i]];
    for (k = 0; k < B[i]; k += 1) C[i][k] = 'X';
}

--------------------------------

C = 0x5607d3786a90. // memory address of C[0]

C[0] = XXXXXXXXXXX.		// &C[0] = 0x5607d3786a90. (memory address of the first byte-sized memory cell comprising the block of 8 contiguous byte-sized memory cells allocated to C[0]).
C[1] = XXXXXXXXXXXXXXXXXX.		// &C[1] = 0x5607d3786a98. (memory address of the first byte-sized memory cell comprising the block of 8 contiguous byte-sized memory cells allocated to C[1]).
C[2] = XXXXXXXXXXX.		// &C[2] = 0x5607d3786aa0. (memory address of the first byte-sized memory cell comprising the block of 8 contiguous byte-sized memory cells allocated to C[2]).
C[3] = XXXXXXX.		// &C[3] = 0x5607d3786aa8. (memory address of the first byte-sized memory cell comprising the block of 8 contiguous byte-sized memory cells allocated to C[3]).
C[4] = XXXXXXXXXX.		// &C[4] = 0x5607d3786ab0. (memory address of the first byte-sized memory cell comprising the block of 8 contiguous byte-sized memory cells allocated to C[4]).
C[5] = XXXXXXX.		// &C[5] = 0x5607d3786ab8. (memory address of the first byte-sized memory cell comprising the block of 8 contiguous byte-sized memory cells allocated to C[5]).
C[6] = XXXXXXXX.		// &C[6] = 0x5607d3786ac0. (memory address of the first byte-sized memory cell comprising the block of 8 contiguous byte-sized memory cells allocated to C[6]).
C[7] = XXXXXXXXXXX.		// &C[7] = 0x5607d3786ac8. (memory address of the first byte-sized memory cell comprising the block of 8 contiguous byte-sized memory cells allocated to C[7]).
C[8] = XXXXXXXXXX.		// &C[8] = 0x5607d3786ad0. (memory address of the first byte-sized memory cell comprising the block of 8 contiguous byte-sized memory cells allocated to C[8]).
C[9] = XXXXXXX.		// &C[9] = 0x5607d3786ad8. (memory address of the first byte-sized memory cell comprising the block of 8 contiguous byte-sized memory cells allocated to C[9]).

--------------------------------

STEP_6: RELEASE MEMORY WHICH WAS ALLOCATED TO THE DYNAMIC ARRAYS NAMED A, B, AND C.

--------------------------------

// De-allocate memory which was assigned to the dynamically-allocated array of S int type values.
delete [] A; // Free up S contiguous int-sized chunks of memory which were assigned to the dynamic array named A.

De-allocate memory which was assigned to the dynamically-allocated array of T int type values.
delete [] B; // Free up T contiguous int-sized chunks of memory which were assigned to the dynamic array named B.

// De-allocate memory which was assigned to the dynamically-allocated array of T pointer-to-char type values.
for (i = 0; i < T; i += 1) delete [] C[i]; // Free up B[i] char-sized chunks of memory which were assigned to the dynamic array named C[i].
delete [] C; // Free up T contiguous pointer-to-char-sized chunks of memory which were assigned to the dynamic array named C.

--------------------------------
End Of Program
--------------------------------

This web page was last updated on 06_NOVEMBER_2024. The content displayed on this web page is licensed as PUBLIC_DOMAIN intellectual property.