Our teacher said that from now on we should only be using pointers, but how far does that actually go? Do you use a pointer for every single variable you are going to use? Like in the following example:
#include <iostream>
#include <string>
#include "Fish.h"
usingnamespace std;
int menu();
void inputData(int *const, Fishing*);
void displayData();
void exit();
int main()
{
Fishing *fishData;
int fishnum,
//Pointer initialized to fishnum
*pnum=&fishnum,
option;
cout<<"Enter the number of fish caught: ";
cin>>*pnum;
while(*pnum<0)
{
cout<<"ERROR. Please enter a positive value: ";
cin>>*pnum;
}
//Here, should I send the pointer instead?
fishData=new Fishing[fishnum];
//Here, should I equate the same pointer to option then replace "option" with the pointer?
//Ex: pnum=&option;
//Ex: *pnum=menu();
option=menu();
switch(option)
{
//etc etc
}
}
Think what I am asking is basic programming practice. Does he literally mean that we should use a pointer for every single variable including constants, or is it suitable to only use them when getting user-input data?