Created
March 13, 2018 05:33
-
-
Save yanshengjia/589cc312a3630e6cea5b43cdac83934e to your computer and use it in GitHub Desktop.
Find last element in the array
This file contains 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 <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