Advertisement
Tkap1

Untitled

Jan 26th, 2024
620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1.  
  2. int main(void)
  3. {
  4.     char array1[100];
  5.     char array2[20];
  6.  
  7.     char* ptr = array2;
  8.     sizeof(ptr) // you want 20 here, right?
  9.     ptr -= 100;
  10.     sizeof(ptr) // what now? 100? 20? 120? ptr points to the same place as array1.
  11.  
  12.     // 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
  13.    
  14.     return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement