comparing pointers

 #include <stdio.h>


int main(){
int arr[10];
int * ptr= &arr[0];
ptr=ptr+2;
if(ptr==&arr[2])
{
    printf("These point to the same memory location\n%u %u",ptr,&arr[2]);
}
    else
    {
        printf("These do not point to the same memory location\n");
    }

 return 0;
}

Comments