C# Language The asterisk is part of the type


Example

In C and C++, the asterisk in the declaration of a pointer variable is part of the expression being declared. In C#, the asterisk in the declaration is part of the type.

In C, C++ and C#, the following snippet declares an int pointer:

int* a;

In C and C++, the following snippet declares an int pointer and an int variable. In C#, it declares two int pointers:

int* a, b; 

In C and C++, the following snippet declares two int pointers. In C#, it is invalid:

int *a, *b;