sliver__

[C++] Working with the main Function 본문

CS/C++

[C++] Working with the main Function

sliver__ 2022. 11. 16. 23:50
728x90
  • main function의 틀은 아래와 같다.
int main()
{
	return 0;
}
  • C와 다르게 C++은 return statement가 선택적이다.
  • 따로 정의가 되어 있지 않으면 compiler는 return 0을 추가한다.
  • C / C++ 파일의 구분은 file extension으로 구분한다.

 

  • 컴파일 과정은 아래와 같다.
    1. main.cpp 파일 생성
    2. 코드를 작성 ( main 포함 )
    3. main.cpp compile ( g++ main.cpp )
    4. executable file 생성 ( main.out ) 
728x90

'CS > C++' 카테고리의 다른 글

[C++] Pointer 와 Reference  (0) 2022.11.17
[C++] 변수 초기화 이해하기  (0) 2022.11.17
[C++] Linking Object Files  (0) 2022.11.16
[C++] Compiling a File into an Object File  (0) 2022.11.16
[C++] Header / Source 파일의 차이  (0) 2022.11.16
Comments