Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ca8d799
주석 실습 솔루션
chaebkimm Feb 22, 2025
161bb95
Update main.c
chaebkimm Feb 23, 2025
2926d04
Update .gitignore
chaebkimm Feb 23, 2025
95c4f5f
Update main.c
chaebkimm Feb 24, 2025
9a2d2d0
Update main.c
chaebkimm Feb 24, 2025
b19bbbe
Update main.c
chaebkimm Feb 24, 2025
06508ce
Update README.md
chaebkimm Mar 11, 2025
ba9f94a
Create .editorconfig
chaebkimm Mar 11, 2025
aa45b80
Update and rename Computer-Programming-and-Practice-2025-1.sln to Sol…
chaebkimm Mar 11, 2025
d17f0d5
Update and rename Computer-Programming-and-Practice-2025-1.vcxproj to…
chaebkimm Mar 11, 2025
753bd8a
Update and rename Project-Function-Definitions-No-Parameter.vcxproj t…
chaebkimm Mar 11, 2025
5322be8
Update and rename Computer-Programming-and-Practice-2025-1.vcxproj.fi…
chaebkimm Mar 11, 2025
46eb4fc
Update main.c
chaebkimm Mar 11, 2025
cd16bd7
Rename Solution-Week1.sln to Solution-Week2.sln
chaebkimm Mar 11, 2025
ec1a7ed
Update README.md
chaebkimm Mar 11, 2025
e665d99
Update and rename Project-Function-Declarations-No-Parameter.vcxproj …
chaebkimm Mar 11, 2025
6daedd5
Rename Project-Function-Declarations-No-Parameter.vcxproj.filters to …
chaebkimm Mar 11, 2025
c9de8b0
Update Solution-Week2.sln
chaebkimm Mar 11, 2025
94ca8a9
Update main.c
chaebkimm Mar 11, 2025
4ef0ba5
Update README.md
chaebkimm Mar 13, 2025
59041ca
Update README.md
chaebkimm Mar 13, 2025
f81fedb
Update README.md
chaebkimm Mar 13, 2025
84081fc
Update Project-Function-Declarations-With-Parameter-List.vcxproj
chaebkimm Mar 13, 2025
af8907d
2주차 매개변수
Mar 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*.c]
charset = utf-8
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*/*
Computer-Programming-and-Practice-2025-1.vcxproj.user
51 changes: 51 additions & 0 deletions Project-Function-Declarations-With-Parameter-List.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{56298b6a-7bcc-4ad5-857c-3ae51b8ca9fa}</ProjectGuid>
<RootNamespace>ProjectFunctionDeclarationsWithParameterList</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
14 changes: 14 additions & 0 deletions Project-Function-Declarations-With-Parameter-List.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="c 소스 파일">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>c</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.c">
<Filter>c 소스 파일</Filter>
</ClCompile>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,44 @@
# Computer Programming and Practice 2025-1
컴퓨터 프로그래밍 및 실습 과목의 수업 홈페이지
# 함수선언 (매개변수리스트가 있을 때)

매개변수는 함수가 호출될 때마다 메모리 공간을 새로 할당받고 함수 실행을 종료할 때 삭제됩니다.
매개변수의 초기값은 호출할 때 정한 값입니다.
함수 선언은 함수의 이름, 반환타입, 매개변수의 타입을 정합니다.
함수 선언시 매개변수의 이름은 적지 않고 타입만 적어도 됩니다.
매개변수가 없는 함수를 선언할 때는 괄호 안에 void만 적습니다.

`타입` `이름` `(` `매개변수리스트` `)` `;` 형태로 함수선언을 합니다.

`매개변수리스트`는 `매개변수선언` 또는 `매개변수리스트` `,` `매개변수선언` 입니다.

`매개변수선언`은 `타입` `이름` 또는 `타입` 입니다.

#### 코드 예시:
```c
int f(int, int); /* 반환 타입이 int고, 이름이 f고, 매개변수 두개의 타입이 모두 int인 함수의 선언 */
int g(int a, int b); /* 이름이 g고, 함수 종류는 f와 동일한 함수의 선언 */
int h(void); /* 반환 타입이 int고, 이름이 h고, 매개변수가 없는 함수의 선언 */
int x(); /* 반환 타입이 int고, 이름이 x고, 매개변수에 대해서는 정하지 않은 함수의 선언 */
```

#### 관련 C 표준
3.5.4.3 Function declarators (including prototypes)
> Semantics
>
> A parameter type list specifies the types of, and may declare identifiers for, the parameters of the function.
> ... The special case of void as the only item in the list specifies that the function has no parameters.

3.5 DECLARATIONS
> Constraints
>
> All declarations in the same scope that refer to the same object or function shall specify compatible types.

3.5.4.3 Function declarators (including prototypes)
> Semantics
>
> For two function types to be compatible, both shall specify compatible retury types.
> Moreover, the paremeter type lists, ... , shall agree in the number of parameters ... ;
> corresponding parameters shall have compatible types. ...

1.6 DEFINITION OF TERMS
> Parameter --- an object declared as part of a function declaration or definition
> that acquires a value on entry to the function, or ...
22 changes: 22 additions & 0 deletions Solution-Week2.sln
Original file line number Diff line number Diff line change
@@ -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-With-Parameter-List", "Project-Function-Declarations-With-Parameter-List.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
27 changes: 27 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* 매개변수리스트가 있는 함수 선언 */

/* 문법
* 함수 선언에서 매개변수 정보를 쓰려면 함수의반환타입 함수이름 ( 매개변수타입 매개변수이름 ) ; 형식으로 선언합니다.
* 매개변수를 여러개 쓸 때는 ,로 구분합니다.
* 매개변수가 없음을 의미할때는 매개변수이름은 없이 void라고만 씁니다.
*
* 의미
* 해당 이름이 특정 반환타입의 함수를 뜻한다고 정하고, 매개변수의 개수와 각각의 타입도 정합니다.
*/

/* To Do: 반환 타입이 int이고 이름이 value이고, 매개변수가 int 타입 하나인 함수를 선언해보세요 */
int value(int number);
int main() {
return value(5);
}

/*
* 함수 이름: value
* 반환 타입: int
* 매개 변수: int x
*
* value 함수는 int 타입 매개 변수의 값을 그대로 반환한다.
*/
int value(int x) {
return x;
}