Question: I would like to ask why the pointer can be compared with another pointer. I have tried the cout pointer and will have an address

I would like to ask why the pointer can be compared with another pointer. I have tried the cout pointer and will have an address like 00fe765rx8. Do not understand how to compare, I do not understand why the example appears 0
Pointer arithmetic and expressions Pointer assignment . Pointer can be assigned to another pointer Both pointers MUST be of the same type ptr2 ptr1; // ptr2 points to the same // location as ptr1 does Pointer comparison (by equality or relational operator) sCompare addresses stored in pointers Meaningless unless pointers point to elements of the same array Examples if (pt r1 == 0) { if (ptr2> ptr1) } // if ptrl is0 (null pointer) > // if ptr2 has a higher index
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
