Run Code  | Code Wall  | Users  | Misc  | Feedback  | About  | Login  | Theme  | Privacy 

return reference (gcc)

Language: Editor: Layout:
+ ] Compiler args + ] Show input
Compilation time: 0.45 sec, absolute running time: 0.22 sec, cpu time: 0.13 sec, memory peak: 3 Mb, absolute service time: 0,67 sec 
fork mode |  history  | discussion
Warning(s):
source_file.cpp: In function ‘const int& func()’:
source_file.cpp:5:25: warning: reference to local variable ‘a’ returned [-Wreturn-local-addr]
 const int& func() { int a=10; return a; }
                         ^
Error(s):
Invalid memory reference (SIGSEGV)