Home Forums US Life 간단한 시뿔뿔 문제 This topic has [27] replies, 0 voices, and was last updated 3 years ago by ㅈ. Now Editing “간단한 시뿔뿔 문제” Name * Password * Email Topic Title (Maximum Length 80) 아래 테스트1과 테스트2의 경우, 왜 결과가 그렇게 나오는지 이해가 안가는군요. 혹시 각각다른 아웃풋결과를 이해하기위한 설명이 뭘까요? 그리고 저 함수에서 10을 메인에서 뽑아내는 방법이 있나요? 1. 테스트1 #include <iostream> using namespace std; int& fun() { int x = 10; return x; } int main() { cout << "main: " << fun() << endl; return 0; } 2. 테스트2 #include <iostream> using namespace std; int& fun() { int x = 10; int& x1 = x; return x1; } int main() { cout << "main: " << fun() << endl; // main: 0 return 0; } I agree to the terms of service Update List