Skip to content

Instantly share code, notes, and snippets.

@yanshengjia
Created March 13, 2018 05:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yanshengjia/589cc312a3630e6cea5b43cdac83934e to your computer and use it in GitHub Desktop.
Save yanshengjia/589cc312a3630e6cea5b43cdac83934e to your computer and use it in GitHub Desktop.
Find last element in the array
#include <iostream>
using namespace std;
int main() {
int a[] = {1, 2, 3, 4, 5};
int res = *((int *)(&a + 1) - 1);
cout << res << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment