// Basic C++

#include <iostream>
using namespace std;

void square_by_reference(int &);
void square_by_reference(double &);

int main(int argc, char* argv[]) {
    // calling by reference
    int z = 4;
    cout << "z = " << z << "\n";
    square_by_reference(z);
    cout << "z is now = " << z << "\n";
    double y = 56.6;
    square_by_reference(y);
    cout << "y is now = " << y << "\n";
    // memory allocation
    int *array = new int[100];
    for(int i=0; i != 100; i++) {
        array[i] = i;
    }
    delete[] array;
}

void square_by_reference(int &cref) {
    cout << "Squaring integers!\n";
    cref = cref * cref; 
}

void square_by_reference(double &cref) {
    cout << "Squaring doubles!\n";
    cref = cref * cref; 
}


