Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(void)
- {
- char array1[100];
- char array2[20];
- char* ptr = array2;
- sizeof(ptr) // you want 20 here, right?
- ptr -= 100;
- sizeof(ptr) // what now? 100? 20? 120? ptr points to the same place as array1.
- // The problem here is that any time you do pointer math you are going to have to check every array and see if a pointer lands on one
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement