-5

I have a question I would appreciate it if you could clarify it. I am new to c and I encountered a part of the code in c which is as follows

#include <List.h>
LIST<P1*> p1 

where the p1 is

class P1
  {
     public:

P1(int i, VECTOR xi); 

Could you please tell me what p1* means in LIST<P1*>?

Is that a pointer?

William Pursell
  • 204,365
  • 48
  • 270
  • 300

1 Answers1

0

like comments said, "P1*" is a pointer to an object of type "P1".

On the other hand " * p1" is an indirection (telling the compiler that it is an adress) on the content of the pointer p1;

P1* pp1;
P1 p1;

returning *pp1 is like returning p1;

returning pp1 return the adress of the pointed object.

cf : C++ - *p vs &p vs p

soca
  • 1
  • 6