Pointer Comparison (Relational Operation)
The following operations can be performed on pointers
Example
#include<stdio.h>
int main()
{
int *ptr1 = (int *) 2000;
int *ptr2 = (int *) 2002;
int r;
r = ptr1 != ptr2;
if(r == 0)
{
printf("Both are equal");
}
else
{
printf("Both are not equal");
}
return 0;
}
Output
Both are not equal
Views: 0