Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
You can apply the following operators to compare pointers of any type:
== != < > <= >=
The comparison operators compare the addresses of the two operands as if they are unsigned integers.
Example
// compile with: /unsafe
class CompareOperators
{
unsafe static void Main()
{
int x = 234;
int y = 236;
int* p1 = &x;
int* p2 = &y;
System.Console.WriteLine(p1 < p2);
System.Console.WriteLine(p2 < p1);
}
}
Sample Output
True
False
See Also
Reference
Pointer Expressions (C# Programming Guide)
Manipulating Pointers (C# Programming Guide)
Pointer types (C# Programming Guide)
fixed Statement (C# Reference)