#include <iostream>
int a = 9;
int *p;
p = &a;
int fun();
int main()
{
std::cout << fun();
return 0;
}
int fun()
{
return *p;
}
Why does this code give the error:
expected constructor, destructor, or type conversion before '=' token|
Whereas this code runs OK:
#include <iostream>
int a = 9;
int *p = &a;
int fun();
int main()
{
std::cout << fun();
return 0;
}
int fun()
{
return *p;
}