diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a5beda6..79b3f79 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -70,13 +70,22 @@ "type": "cppbuild", "label": "C/C++: gcc.exe 활성 파일 빌드", "command": "C:/mingw64/bin/gcc.exe", + // main 다수 (테스트) "args": [ "-fdiagnostics-color=always", "-g", - "${fileDirname}\\*.c", + "${file}", "-o", - "${fileDirname}\\bin\\${fileBasenameNoExtension}.exe" + "${fileDirname}\\bin\\${fileBasenameNoExtension}.exe", ], + // // main 단일 프로젝트 + // "args": [ + // "-fdiagnostics-color=always", + // "-g", + // "${fileDirname}\\*.c", + // "-o", + // "${fileDirname}\\bin\\${fileBasenameNoExtension}.exe" + // ], "options": { "cwd": "C:/mingw64/bin" }, diff --git a/practice/lc_functionArgsByReference.c b/practice/lc_functionArgsByReference.c new file mode 100644 index 0000000..2e49360 --- /dev/null +++ b/practice/lc_functionArgsByReference.c @@ -0,0 +1,15 @@ +#include + +void addone(int n) +{ + n++; +} + +int main() +{ + int n = 0; + printf("Step0: %d\n", n); + addone(n); + printf("Step2: %d\n", n); + +} \ No newline at end of file diff --git a/practice/lc_structures.c b/practice/lc_structures.c new file mode 100644 index 0000000..e07267c --- /dev/null +++ b/practice/lc_structures.c @@ -0,0 +1,30 @@ +#include + +struct Point +{ + int x; + int y; +}; + +typedef struct +{ + char* brand; // 동적 할당을 위한 처리 + int model; +} Vehicle; + +int main() +{ + struct Point pt; + pt.x = 10; + pt.y = 5; + + Vehicle vc; + vc.brand = "Ford"; + vc.model = 2025; + + printf("pt.x: %d\n", pt.x); + printf("pt.y: %d\n", pt.y); + printf("\n"); + printf("vc.brand: %s\n", vc.brand); + printf("vc.model: %d\n", vc.model); +} \ No newline at end of file