// @topic T51004 Miscellaneous small samples developed in class // @brief 10/04/2012 -- allocating/deallocating arrays, using a vector #include "rrxing.h" using namespace std; // function using C++ pointers: int multiply( int const* left, int const* right ) { return (*left) * (*right); // ugly } // function using C++ references: int multiply( int const& left, int const& right ) { return left * right; // using references instead of pointers } void print_msg( char const* pchar ) { cout << pchar; } int main() { // using pointers to characters: char my_message[] = { 'B','y','e', '\0' }; print_msg( my_message ); print_msg( "HELLO\n" ); int one = 2; int two = 5; // using pointers: cout << multiply( &one, &two ) << "\n"; // using references: cout << multiply( one, 10 ) << "\n"; return 0; }