Skip to content

Instantly share code, notes, and snippets.

@xjdrew
Created November 15, 2018 12:42
Show Gist options
  • Save xjdrew/0da9738b1e5a873fec214cbe7dda8acb to your computer and use it in GitHub Desktop.
Save xjdrew/0da9738b1e5a873fec214cbe7dda8acb to your computer and use it in GitHub Desktop.
null reference
#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