diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8d3a3fd --- /dev/null +++ b/.editorconfig @@ -0,0 +1,2 @@ +[*.c] +charset = utf-8 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bc46f2c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*/* +Computer-Programming-and-Practice-2025-1.vcxproj.user diff --git a/Project-Function-Calls-No-Parameter.vcxproj.user b/Project-Function-Calls-No-Parameter.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/Project-Function-Calls-No-Parameter.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Project-Function-Declarations-No-Parameter.vcxproj b/Project-Function-Declarations-No-Parameter.vcxproj new file mode 100644 index 0000000..f0845b9 --- /dev/null +++ b/Project-Function-Declarations-No-Parameter.vcxproj @@ -0,0 +1,51 @@ + + + + + Debug + x64 + + + + 17.0 + Win32Proj + {56298b6a-7bcc-4ad5-857c-3ae51b8ca9fa} + ProjectFunctionDeclarationsNoParameter + 10.0 + + + + Application + true + v143 + Unicode + + + + + + + + + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + /utf-8 %(AdditionalOptions) + + + Console + true + + + + + + + + + diff --git a/Project-Function-Declarations-No-Parameter.vcxproj.filters b/Project-Function-Declarations-No-Parameter.vcxproj.filters new file mode 100644 index 0000000..15aa408 --- /dev/null +++ b/Project-Function-Declarations-No-Parameter.vcxproj.filters @@ -0,0 +1,14 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + c + + + + + c 소스 파일 + + + diff --git a/Project-Function-Declarations-No-Parameter.vcxproj.user b/Project-Function-Declarations-No-Parameter.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/Project-Function-Declarations-No-Parameter.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/README.md b/README.md index bb3e4ff..fa9df0b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,22 @@ -# Computer Programming and Practice 2025-1 - 컴퓨터 프로그래밍 및 실습 과목의 수업 홈페이지 +# 함수선언 (매개변수가 없을 때) + +함수 선언은 함수 정의, 전역변수 선언과 더불어 전처리 후의 C 프로그램을 구성합니다. +함수 선언은 이름이 특정 반환타입의 함수를 가리킨다고 정합니다. + +`타입` `이름` `(` `)` `;` 형태로 씁니다. + +#### 코드 예시: +```c +/* 반환 타입이 void고, 이름이 x인 함수의 선언 */ +void x(); +``` + +#### 관련 C89 표준 +3.5.4.3 Function declarators (including prototypes) +> Semantics +> +> If, in the declaration "T D1", D1 has the form +> +> D( ... ) +> +> ... then the type specified for ident is " ... function returning T." diff --git a/Solution-Week2.sln b/Solution-Week2.sln new file mode 100644 index 0000000..e46df0c --- /dev/null +++ b/Solution-Week2.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.13.35818.85 d17.13 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project-Function-Declarations-No-Parameter", "Project-Function-Declarations-No-Parameter.vcxproj", "{56298B6A-7BCC-4AD5-857C-3AE51B8CA9FA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {56298B6A-7BCC-4AD5-857C-3AE51B8CA9FA}.Debug|x64.ActiveCfg = Debug|x64 + {56298B6A-7BCC-4AD5-857C-3AE51B8CA9FA}.Debug|x64.Build.0 = Debug|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7548D284-3031-4A53-8359-876BE48586E0} + EndGlobalSection +EndGlobal diff --git a/main.c b/main.c new file mode 100644 index 0000000..dffe2a1 --- /dev/null +++ b/main.c @@ -0,0 +1,23 @@ +/* 매개변수가 없는 함수의 선언 */ + +/* 문법 + * 매개변수가 없는 함수는 타입 이름 ( ) ; 형식으로 선언합니다. + * + * 의미 + * 해당 이름이 특정 반환타입의 함수를 뜻한다고 정합니다. + */ + +/* To Do: 반환 타입이 int이고 이름이 five인 함수를 선언해보세요 */ + +int main() { + return five(); +} + +/* + * 함수 이름: five + * 반환 타입: int + * five()는 5를 결과값으로 반환한다. + */ +int five() { + return 5; +}