다음 C++ 프로그램의 출력 결과는?
#include<iostream.h>
void inc_counter1(int *counter)
{
++(*counter);
}
void inc_counter2(int &counter)
{
++counter;
}
void inc_counter3(int counter)
{
++counter;
}
void main()
{
int a_count = 0;
inc_counter1(&a_count);
inc_counter2(a_count);
inc_counter3(a_count);
cout<<a_count<<'\n';
}- ①0
- ②1
- ③2
- ④3
선지를 골라 바로 채점해 보세요.
정답 ③
출처: 인사혁신처 공개 기출(공공데이터포털, 이용허락 제한 없음)