Pointers and Declaration of Pointers

Hello Everyone !

I am starting working with C++ language and I have the following doubts:

1. Is there any difference when I specify the following members within a class ?
class TExample :
{
private:
TList * ListExample1; //TList is a class
TList *ListExample2; //TList is a class
TList* ListExample3; //TList is a class

Is there any difference among the declarations of ListExample1, ListExample2 and ListExample3 ?
Or do all declarations mean a pointer to TList written in different ways ?

2. I'd like to ask the same question for declaration of functions:

TList* FunctionName1();
TList * FunctionName2();
TList *FunctionName3();

Do all declarations mean the same thing ? I mean all declarations return a pointer to TList ? Or is there any difference ?

3. I'd like to ask the same question for functions parameters:

void FunctionName1(TScrollBox* Mapa_ScrollBox);
void FunctionName2(TScrollBox * Mapa_ScrollBox);
void FunctionName3(TScrollBox *Mapa_ScrollBox);

Do all declarations mean the same thing ? I mean all declarations specify a pointer to TScrollBox class as the argument ? Or is there any difference ?

Looking forward to news.

Thanks in advance,

Carlos
There is no difference between

int* pointer1; , int *pointer1; and int * pointer1;.



:)
Last edited on
So I can conclude that the answer for those 3 questions is the same: "There is no difference". Is that true ?
you are correct
but there can be.. see this:

int* ptr1, ptr2;

;)
ptr2 is not a pointer, but a normal int.

1
2
3
4
5
6
7
8
int* ptr1, ptr2;

// is the same as...
int *ptr1, ptr2;

// is the same as...
int* ptr1;
int ptr2;


I never liked that about C/C++. * should be part of the type, not part of the variable. They really should both be pointers. Chalk this up to a language flaw.
closed account (S6k9GNh0)
I never knew that and that also explains why my first pointer never worked. T.T
Topic archived. No new replies allowed.