Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file removed .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
7 changes: 7 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// IntelliSense를 사용하여 가능한 특성에 대해 알아보세요.
// 기존 특성에 대한 설명을 보려면 가리킵니다.
// 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요.
"version": "0.2.0",
"configurations": []
}
29 changes: 29 additions & 0 deletions .vscode/tasks 2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang 활성 파일 빌드",
"command": "/usr/bin/clang",
"args": [
"-fcolor-diagnostics",
"-fansi-escape-codes",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "디버거에서 생성된 작업입니다."
}
],
"version": "2.0.0"
}
29 changes: 29 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang 활성 파일 빌드",
"command": "/usr/bin/clang",
"args": [
"-fcolor-diagnostics",
"-fansi-escape-codes",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "디버거에서 생성된 작업입니다."
}
],
"version": "2.0.0"
}
Binary file added 2주차 실습/1Array
Binary file not shown.
19 changes: 19 additions & 0 deletions 2주차 실습/1Array.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <stdio.h>

int main(void) {
int i, length;
char str[50];

printf("문자열을 입력하세요: ");
gets(str);
printf("\n입력된 문자열은 \n");
for(i = 0; str[i]; i++){
printf("%c",str[i]);
length ++;
}
printf("\n입니다. \n");

printf("입력된 문자열의 길이 = %d \n", length);

return 0;
}
Binary file added 2주차 실습/2DeCharArray
Binary file not shown.
26 changes: 26 additions & 0 deletions 2주차 실습/2DeCharArray.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <stdio.h>

int main(void) {
int i,j,k;
char student[2][3][20];

for (i = 0; i < 2; i++){
printf("\n 학생 %d의 이름 : ", i + 1);
gets(student[i][0]);
printf("\n 학생 %d의 학과 : ", i + 1);
gets(student[i][1]);
printf("\n 학생 %d의 학과 : ", i + 1);
gets(student[i][2]);
}

for(i = 0; i < 2; i ++){
printf("학생%d \n", i + 1);
for(j = 0; j < 3; j++){
// printf(" %c \n", student[i][j][20]);
for (k = 0; student[i][j][k] != '\0'; k++) {
printf(" %c \n", student[i][j][k]);
}
}
}
return 0;
}
Binary file added 2주차 실습/3Array
Binary file not shown.
25 changes: 25 additions & 0 deletions 2주차 실습/3Array.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <stdio.h>

int main(void) {
int i,j,k;
int array[2][3][4];

for(i = 0; i < 2; i++){
for(j = 0; j < 3; j++){
for(k =0; k < 4; k++){
printf("array[%d][%d][%d] =", i, j, k);
scanf("%d",&array[i][j][k]);
}
}
}

for(i = 0; i < 2; i++){
for(j = 0; j < 3; j++){
for(k =0; k < 4; k++){
printf("array[%d][%d][%d] = %d \n", i, j, k, array[i][j][k]);
}
}
}

return 0;
}
Binary file added 2주차 실습/pointer1
Binary file not shown.
10 changes: 10 additions & 0 deletions 2주차 실습/pointer1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <stdio.h>

int main(void) {
int num = 10;
int *pnum = &num;

printf("%d, %d \n", num, *pnum);

return 0;
}
20 changes: 20 additions & 0 deletions 2주차 실습/pointer1.dSYM/Contents/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.pointer1</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
triple: 'arm64-apple-darwin'
binary-path: "/Users/hataeuk/Documents/Data_Structure_Assignment/2주차 실습/pointer1"
relocations: []
...
Binary file added 2주차 실습/pointerArray
Binary file not shown.
9 changes: 9 additions & 0 deletions 2주차 실습/pointerArray.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <stdio.h>

int main(void) {

char string[3][10] = {"Dreams", "come", "true!"};
char *ptr[3] = {"Dreams", "come", "true!"};

return 0;
}
20 changes: 20 additions & 0 deletions 2주차 실습/pointerArray.dSYM/Contents/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.pointerArray</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
triple: 'arm64-apple-darwin'
binary-path: "/Users/hataeuk/Documents/Data_Structure_Assignment/2주차 실습/pointerArray"
relocations: []
...
Binary file added 2주차 실습/ponter_assginment1
Binary file not shown.
17 changes: 17 additions & 0 deletions 2주차 실습/ponter_assginment1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <stdio.h>

int main(void) {
int i;
char *ptr[4] = { {"Korea"}, {"Seoul"}, {"Mapo"}, {"152번지 2/3"} };
for (i = 0; i <4; i++){
printf("\n %s", ptr[i]);
}
printf("\n");
ptr[2] = "Jongno";
for (i = 0; i <4; i++){
printf("\n %s", ptr[i]);
}

return 0;

}
80 changes: 80 additions & 0 deletions 4주차 강의자료 실습/실습1/InsertLinkedList.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "InsertLinkedList.h"

//공백 연결 리스트를 생성하는 연산
linkedList_h* createLinkedList_h(void) {
linkedList_h* L;
L = (linkedList_h*)malloc(sizeof(linkedList_h));
L -> head = NULL;
return L;
}

//연결 리스트의 전체 메모리를 해제하는 연산
void freeLinkedList_h(linkedList_h* L) {
listNode* p;
while (L -> head != NULL) {
p = L -> head;
L -> head = L -> head -> link;
free(p);
p = NULL;
}
}

//연결 리스트를 순서대로 출력하는 연산
void printList(linkedList_h* L){
listNode *p;
printf("L = (");
p = L -> head;
while ( p != NULL) {
printf("%s", p -> data);
p = p -> link;
if(p != NULL) printf(", ");
}
printf("\n");
}

// 첫번째 노드로 삽입하는 연산
void insertFirstNode(linkedList_h * L, char* x){
listNode* newNode;
newNode = (listNode*)malloc(sizeof(listNode)); //삽입할 새 노드 할당
strcpy(newNode -> data, x); //새 노드의 데이터 필드에 x 저장
newNode -> link = L -> head;
L -> head = newNode;
}

//노드를 pre 뒤에 삽입하는 연산
void insertMiddleNode(linkedList_h* L, listNode *pre, char* x) {
listNode* newNode;
newNode = (listNode*)malloc(sizeof(listNode));
strcpy(newNode -> data, x);
if (L -> head == NULL) { //공백 리스트인 경우
newNode -> link = NULL; // 새 노드를 첫 번째이자 마지막 노드로 연결
L -> head = newNode;
}
else if(pre == NULL) { //삽입 위치를 지정하는 포인터 pre가 NULL인 경우
newNode -> link = L -> head; //새 노드를 첫 번째 노드로 삽입
L -> head = newNode;
}
else { // 포인터 pre의 노드 뒤에 새 노드 연결
newNode -> link = pre -> link;
pre -> link = newNode;
}
}

void insertLastNode(linkedList_h* L,char* x) {
listNode* newNode;
listNode* temp;
newNode = (listNode*)malloc(sizeof(listNode));
strcpy(newNode -> data, x);
newNode -> link = NULL;
if (L -> head == NULL) { //현재 리스트가 공백인 경우
L -> head = newNode;
return;
}
temp = L -> head;
while(temp -> link != NULL) temp = temp -> link; // 현재 리스트의 마지막 노드를 찾음
temp -> link = newNode; //새 노드를 마지막 노드(temp)의 다음 노드로 연결
}
19 changes: 19 additions & 0 deletions 4주차 강의자료 실습/실습1/InsertLinkedList.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

//단순 연결 리스트의 노드 구조를 구조체로 정의
typedef struct ListNode {
char data[4];
struct ListNode* link;
} listNode;

// 리스트 시작을 나타내는 head 노드를 구조체로 정의
typedef struct {
listNode* head;
} linkedList_h;

linkedList_h* createLinkedList_h(void);
void freeLinkedList_h(linkedList_h* L);
void printList(linkedList_h * L);
void insertFirstNode(linkedList_h * L, char* x);
void insertMiddleNode(linkedList_h * L, listNode * pre, char* x);
void insertLastNode(linkedList_h* L, char* x);
Binary file added 4주차 강의자료 실습/실습1/ex4_1
Binary file not shown.
31 changes: 31 additions & 0 deletions 4주차 강의자료 실습/실습1/ex4_1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "InsertLinkedList.h"

int main(void){
linkedList_h* L;
L = createLinkedList_h();
printf("(1) 공백 리스트 생성하기! \n");
printList(L);

printf("(2) 리스트에 [수] 노드 삽입하기! \n");
insertFirstNode(L, "수");
printList(L);

printf("(3) 리스트 마지막에 [금] 삽입하기! \n");
insertLastNode(L, "금");
printList(L);

printf("(4) 리스트 첫번째에 [월] 삽입하기! \n");
insertFirstNode(L, "월");
printList(L);

printf("(5) 리스트 공간을 해제하여 공백 리스트로 만들기! \n");
freeLinkedList_h(L);
printList(L);


getchar(); return 0;
}
Binary file added 4주차 강의자료 실습/실습2/ex4_2
Binary file not shown.
Loading