0

why did the main pointer display 1? What this means?

#include <iostream> using namespace std; int main() { int score = 5; int foreva = 6; cout << &main << endl; return 0; }

11th Oct 2018, 8:40 PM
MakarovDs
2 Answers
12th Oct 2018, 1:29 AM
John Wells
John Wells - avatar
+ 1
1. There's no pointer in that code (& is address-of, a pointer is a variable). 2. You're _trying_ to get the address of main(). 3. [Edit] Turns out it's legal-ish, but pointless because it gets re-cast to a bool so any function will be 1[/edit]
11th Oct 2018, 11:30 PM
non