Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.