Created
November 15, 2018 12:42
-
-
Save xjdrew/0da9738b1e5a873fec214cbe7dda8acb to your computer and use it in GitHub Desktop.
null reference
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int* a[5]; | |
int& ref() { | |
return *a[0]; | |
} | |
void print(int* p) { | |
printf("%p\n", p); | |
} | |
int main() { | |
a[0] = (int*)1; | |
print(&ref()); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment