My question is fairly simple... i have an array of chars from an input file and the user needs to be able to input a memory location (im using an int) and see if anything in the array is located at said locations... so I need to know how to store the memory address of a char as an int, so i can compare it with the users inputed int...
char a = 'z';
ptr = &a;
int user_address, real_address;
printf("address of a: %d or %d\n", &a, ptr); - both of these print the address im looking for, but i cannot seem to figure out how to store that address so i can use it in an if statement.
if(real_address == user_address) - need this to work
real_address = (int)&a;
real_address = (int)ptr;
i would have thought one of those would work... but they won't compile. any ideas?