Undefined var still prints
how can this code work?
how can it print num1 in main function when num1 has not been defined as a var by me???
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
#include <cstdlib>
#include <iostream>
using namespace std;
int num1()
{
int var1 = 4;
cout<< 4 << endl;
return 0;
}
int main(int argc, char *argv[])
{
num1();
cout<<num1;
system("PAUSE");
return 0;
}
|
you're printing out the location in memory of your function num1().
Topic archived. No new replies allowed.