Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
return reference (gcc)
//g++ 5.4.0 #include <iostream> const int& func() { int a=10; return a; } void func2(int v) { std::cout<<"function: "<<v<<std::endl; } int stackFunc() { int a1 = 15; int a2 = a1; int a3 = a2; return a3; } int main() { // Моментальное использование int b = func(); std::cout << "b: " << b << std::endl; const int& ra = func(); std::cout << "ra: " << ra << std::endl; const int& ra2 = func(); int aa = ra2; std::cout << "aa: " << aa << std::endl; // Действия со стеком const int& ra3 = func(); stackFunc(); int stack = ra3; std::cout << "stack: " << stack << std::endl; // Вызов функции func2(func()); }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Template
candies
Coin changes
FindMedian
Test constructors and operators
Client
is_sorted_30-Seconds-of-C++
cppPyPoly
Big O Notation array problem
Elevator 2
Please log in to post a comment.