int* pointer1, pointer2, pointer3; // Is valid in C#
int *pointer1, *pointer2, *pointer3; // Is Invalid in C#
The unsafe modifier can be used in declaration of a type or a member.
// Method declared with unsafe modifier
unsafe void getName(int empID)
{
// Body of the function
// pointers can be used
}
The body of the above function is treated as unsafe context.
Pointers can also be used in the parameter list, because the scope of the unsafe context is from parameter list to the
end of the method.
We can also declare a block of statements as unsafe.
For example;
unsafe
{
// Statements in the block
}