I got 3 questions.
1.what is the difference between the flowing 2 codes?
//why no errors during compiling as flowing
const int& get3() {
return 3;
}
and
//get a compiler error, says: 'return': cannot convert from 'int' to 'int &'
//and that's understandable
int& get3() {
return 3;
}
2.Why the first one is OK to compile?
3.And when i run the first one, i got the strange result:
That's why?
I'll appreciate it very much if anyone can give me some tips.