How would I compare two memory addresses from a char array with a fixed size? Suppose I have two pointers, each of which points to a different memory location in the array:
char *ptr1;
char *ptr2;
If I do printf("%p\n%p\n", ptr1, ptr2);, then it will print the memory addresses as hexadecimal.
output:
0x601240
0x601274
how would I store them in variables and compare so that I can determine which memory address will be the first in the array.
Another question: Instead of% p, if I do% d to print the memory address, I get:
output:
6296128
6296180
Are these valid memory addresses (I mean, is it safe to use)?
source
share