Type Declaration - Pointer Asterisk Position
- by sahs
Hello, in C++, the following means "allocate memory for an int pointer":
int* number;
So, the asterisk is part of the variable type; without it, that would mean something else (that's why I usually don't separate the asterisk from the variable type). Then what is the reason the asterisk is considered something else, instead of being part of the type? For example, it seems better, if the following meant "allocate memory for two int pointers":
int* number1, number2;
Am I wrong?