Would someone be able to tell me which of these methods of passing data is this best? Thanks.
Code:
#include <iostream.h>
const int MAX_TYPES=2, MAX_LEN=10;
void Test(int *, const char [MAX_TYPES][MAX_LEN], const int);
int main(void)
{
const char TYPE[MAX_TYPES][MAX_LEN]={{"Reference"},{"Pointer"}};
const int REF=0, POINT=1;
int Num, *NumPointer=&Num;
cout << "Enter number: ";
cin >> Num;
Test(&Num, TYPE, REF);
Test(NumPointer, TYPE, POINT);
return 0;
}
void Test(int *Test, const char Type[MAX_TYPES][MAX_LEN], const int TypeCat)
{
cout << "\nAddress of test: " << Test << ".\nValue of test: " << *Test
<< " (passing by " << Type[TypeCat] << ").\n";
cin.get();
}