As part of a program for a class, I have to print the output a specific way, split up into blocks of sixteen bytes. I've been searching for quite a while for a way to cast the pointer to an int or another way to perform a modulus or division remainder operation on the pointer address stored in a variable. I've hit a roadblock, does anyone here know how I could perform this seemingly simple operation? Here's the basic form of the function:
void printAddress(char *loc, char *minLoc, char *maxLoc) {
minLoc = (loc - (loc % 16));
maxLoc = minLoc + 16;
printf("%p - %p - %p", minLoc, loc, maxLoc);
}
I removed all my attempts at casting it to make it clear what I'm trying to do.