U E D R , A S I H C RSS

새싹교실/2012/start Line

Contents</span>2>

1ass="dot">. 새싹실/startLine >
2ass="dot">. 수업 </a>
2.1class="dot">.n> 1회차-환희, 훈 (2012-03-21) >
2.1.1n class="dot">.pan>n> 수업내용 a>
2.1.2n class="dot">.pan>n> 과제 >
2.1.3n class="dot">.pan>n> 후기 >
2.2class="dot">.n> 1회차-재현 (2012-03-22) t>
2.2.1n class="dot">.pan>n> 수업내용 a>
2.2.2n class="dot">.pan>n> 과제 >
2.2.3n class="dot">.pan>n> 후기 >
2.3class="dot">.n> 2회차-환희 (2012-03-26) t>
2.3.1n class="dot">.pan>n> 수업내용 a>
2.3.2n class="dot">.pan>n> 과제 >
2.3.3n class="dot">.pan>n> 후기 >
2.4class="dot">.n> 3회차-환희 (2012-3-28) >
2.4.1n class="dot">.pan>n> 수업내용 a>
2.4.2n class="dot">.pan>n> 과제 >
2.4.3n class="dot">.pan>n> 후기 >
2.5class="dot">.n> 3회차-성훈, 현 (2012-3-28)
2.5.1n class="dot">.pan>n> 수업내용 a>
2.5.2n class="dot">.pan>n> 과제 >
2.5.3n class="dot">.pan>n> 후기 >
2.6class="dot">.n> 4회차-환희 (2012-4-2)
2.6.1n class="dot">.pan>n> 수업내용 a>
2.6.2n class="dot">.pan>n> 과제 >
2.6.3n class="dot">.pan>n> 후기 >
2.7class="dot">.n> 4회차-성훈 (2012-4-3)
2.7.1n class="dot">.pan>n> 수업내용 a>
2.7.2n class="dot">.pan>n> 후기 >
2.7.3n class="dot">.pan>n> 과제 >
2.8class="dot">.n> 5회차-환희 (2012-4-4)
2.8.1n class="dot">.pan>n> 수업내용 a>
2.8.2n class="dot">.pan>n> 후기 >
2.9class="dot">.n> 5회차-성훈 (2012-4-5)
2.9.1n class="dot">.pan>n> 수업내용 a>
2.9.2n class="dot">.pan>n> 후기 >
2.10 class="dot">.an>> 4회차-재현 (2012-4-5) >
2.10.1an class="dot">.span>an> 수내용 </a>
2.10.2an class="dot">.span>an> 후 t>
2.11 class="dot">.an>> 6회차-환희 (2012-4-9) + 7회-환희 (2012-4-9) t>
2.11.1an class="dot">.span>an> 수내용 </a>
2.11.2an class="dot">.span>an> 후 t>
2.12 class="dot">.an>> 8회차 (2012-5-1) - 성, 환 t>
2.12.1an class="dot">.span>an> 수내용 </a>
2.12.2an class="dot">.span>an> 후 t>
2.12.3an class="dot">.span>an> 과 t>
2.13 class="dot">.an>> 9회차(2012-5-9) - 성, 환희 >
2.13.1an class="dot">.span>an> 수내용 </a>
2.13.2an class="dot">.span>an> 후 t>
2.13.3an class="dot">.span>an> 과 - 캘더 만기 >
2.13.4an class="dot">.span>an> 기 t>
2.14 class="dot">.an>> 10회(2012-5-22) - 성훈, 환 dt>
2.14.1an class="dot">.span>an> 수내용 </a>
2.14.2an class="dot">.span>an> 후 t>
2.15 class="dot">.an>> 11회(2012-5-23) - 성훈, 환 dt>
2.15.1an class="dot">.span>an> 수내용 </a>
2.15.2an class="dot">.span>an> 후 t>
2.16 class="dot">.an>> 12회(2012-7-19) </dt>
2.16.1an class="dot">.span>an> 수내용 </a>
2.17 class="dot">.an>> 13회(2012-7-20) </dt>
2.17.1an class="dot">.span>an> 수내용 </a>
2.17.2an class="dot">.span>an> 코
2.17.3an class="dot">.span>an> 질 t>
2.18 class="dot">.an>> 2012-7-30 dt>
2.18.1an class="dot">.span>an> 코 t>
2.19 class="dot">.an>> 2012-8-2 t>
2.19.1an class="dot">.span>an> 코 t>

1ass='dot'>. 싹교/startLine ass='perma' href='#s-1'>&#xB6;h1>
d="sc-1">
  • 모임시간 : 가class='line-anchor' id='line-3'>an>
  • 가르치는 사 : 서 class='line-anchor' id='line-4'>pan>
    >
  • 배우는 사람 : 박환, 이성훈, 최현, 민관pan class='line-anchor' id='line-5'>

2.1.2n class='dot'>.pan> 과제 class='perma' href='#s-2.1.2'>¶;>
"sc-5">
  • 변수 언과 칙연만 한 시점서 어 과제를 내 할지 딱히 오르 것이 없어서 이번는 패.class='line-anchor' id='line-18'>pan>
    >

2.1.3n class='dot'>.pan> 후기 class='perma' href='#s-2.1.3'>¶;>
"sc-6">

2.2.2n class='dot'>.pan> 과제 class='perma' href='#s-2.2.2'>¶;>
"sc-9">
  • 일단 현이 기존 C를 느 정도 공했는를 확하기 위한 간이 따로 과제를 준비지 못 했음.pan class='line-anchor' id='line-30'><br />

2.2.3n class='dot'>.pan> 후기 class='perma' href='#s-2.2.3'>¶;>
"sc-10">
  • 서민관 - 간단하게 현이 C문법 알고는 부 알아보기, 수 만들어보기, 전적인 계획 명, gcc 사용. 일단 제어과 간한 함수 문까지 알고 있는 같다. 어제 도 있어서 장을 이 했는데 래도 각보 어렵지는 았다. 앞으로는 좀 예제등을 비해겠다.<span class='line-anchor' id='line-32'>
  • 최재현 - 아는 범위 확인고 앞으로의 방향 대해 얘기 습니. 다음에는 르는 들에 대해 우고 는 것은 확히 배야겠니다.

2.3.2n class='dot'>.pan> 과제 class='perma' href='#s-2.3.2'>¶;>
"sc-13">
  • 중첩된 반복으로 찍기 - 상당히 특하게 복문 사용했다. 각이 좀 좋 src='/imgs/smile/--.png' style='border:0' class='smiley' alt='-_-' title='-_-' />ass='line-anchor' id='line-41'>n>

int main()
{
   int num1 , num2 = 1, num3, num4 = 2;

   printf("별을 위해서 숫자 입력주세\n");
   scanf("%d", &amp;num1);

   num3 = num1 - 1;

   while(num2 <= num1){
      while(num3 &lt; num1){
         printf("*");
         num3++;
      }
      printf("\n");
      num3 = num3 - num4;
      num2 = num2 + 1;
      num4++;
   }

   return 0;
}
  • 윤년 class='line-anchor' id='line-66'>span>
    />

2.3.3n class='dot'>.pan> 후기 class='perma' href='#s-2.3.3'>¶;>
"sc-14">
  • 박환희 - 오늘은 제문에 한 내용을 웠고 낌은 마음이 편하고 제문에 이러한 종가 있는것 알았고 앞로 문을 좀더 익야겠는것 생각습니.class='line-anchor' id='line-68'>pan>
    >
  • 서민관 - 제어문의 용에 한 수업(if문법, switch.. for...) 몇 제어에서 주의해야 할 들(switch에서의 break, 반복의 종료조건등..) 리고 간중에 쉬면서 희가 간 관심을 인 부들에 대해서 설명(도우 프로그래밍, python, 른 c함수들) 번에 생각보다 진이 매럽지 않아서 이번도 진에 대한 걱을 했데 1:1이라 런지 교적 진행이 편했. 그리고 환가 생보다 다양한 부분 관심 가지고 질을 하아서 기 좋았다. 내기이 C 배우가 꽤 힘들 않을 했는데 의로 if이나 for문에 문법의 이가 빠아서 놀랐다. printf, scanf나 기 헷갈기 쉬운 c의 기본문법을 알고 있어서 간단 실습 하기에 편다.n class='line-anchor' id='line-69'></span> />

2.4.2n class='dot'>.pan> 과제 class='perma' href='#s-2.4.2'>¶;>
"sc-17">
  • 숫자를 세 개 받아서 정렬기.n class='line-anchor' id='line-78'></span> />

2.4.3n class='dot'>.pan> 후기 class='perma' href='#s-2.4.3'>¶;>
"sc-18">
  • 간단한 이전 간(if, 반문)의 복습과 배열 사용 대해 알아았다. 그리고 이번 간에 주로 내용 함수가 왜 요한와 함수를 드는 , 함를 사하는 법 등었다. 개인적으로는 함수 꽤 중요하게 생각는 만 함수의 필성을 캐치해 줬면 좋다. 리고 삼 드는 생이지 환희 질문이 중한 부을 잘 찌른는 생이 든다. 별른 언급도 었는 함수 내에서 변수 scope 함수 내부의 이름 침 등에 대 질문 있었다. 그고 중간에 수 사의 예제로 printf문 약간 이상하게 쓴 드를 보여줬는데 외로 을 잘 잡은 같았다. 현 진행상황으로는 음에 인터 다뤄야 할데 함를 쓰는 것 조금 더 연을 시지 바로 포터를 갈지 고민이다. 당 포인터를 다가 려워지 않을까 르겠. - ref='/wiki.php/%EC%84%9C%EB%AF%BC%EA%B4%80' title="서민관" >서민관
  • 경험했던 것pan class='line-anchor' id='line-81'><br /> - 배열, 배열 쓸 때 자주는 실lass='line-anchor' id='line-82'>an>
    - 함수? 함의 정, 만는 예lass='line-anchor' id='line-83'>an>
    - 숫자 받아 큰 수로 정class='line-anchor' id='line-84'>
    pan>
    > - 해봐 ......? - n>lass='line-anchor' id='line-85'>an>

2.5class='dot'>.n> span>3회차-성, 재현 (2012-3-28) ass='perma' href='#s-2.5'>&#xB6;

2.5.2n class='dot'>.pan> 과제 class='perma' href='#s-2.5.2'>¶;>
"sc-21">

2.5.3n class='dot'>.pan> 후기 class='perma' href='#s-2.5.3'>¶;>
"sc-22">
  • 처음에 간단게 재, 성이의 수에 대한 식을 인했. 그 에 swap 함수 만들어 보 실행의 문제점에 대해 이야를 했다. 함가 실제로 자를 대로 전달하지 않 값을 복사한다는 을 이기 한 후에 인터 대한 이야로 들갔다. 개인으로 싹을 시작하기 전 가장 고민했던 부이 포터를 어떤 이밍 넣는였는, 아래도 call-by-value의 제점 대해 이야기를 면서 인터 꺼내는 것 가장 효과적이지 을까 다. 후에 주로 그림 통해 프로그램 행시 모리 구조가 어떻 되는에 대해서 명을 고 포인터 수를 해 주소값을 넘기 방법(call-by-reference)을 이기했. 그리고 malloc을 이해서 메모리를 할하는 과 배열과 인터 관계 대해서도 루었. 개인적인 낌으는 재이는 약간 현이 극적아서 확히 어느 도 내을 이해했는지 알가 어운 느낌이 다. 최대한 모리 조를 그림으로 알 쉽게 표현했다고 각하데, 그래도 확한 해도 알기 위해는 연문제 등이 요하 않을 싶다. 성훈는 C어 자 외에도 이저런 분에 질문이 많는데 무래 C언 아래 부분쪽에 흥가 좀 있는 같다. 그리 아무도 예제를 더 구해야 지 않까 하는 생이 든. - href='/wiki.php/%EC%84%9C%EB%AF%BC%EA%B4%80' title="민관" >서민n class='line-anchor' id='line-95'></span> />
  • 포인터의 기와 포터를 이용한 swap 함수 구, 값 환. 그리고 malloc의 태 기초와 더 쉽게 쓰 법 익힘. 다엔 malloc을 용한 용프그램 구현을 해보 싶다. - n>lass='line-anchor' id='line-96'>an>
  • 포인터의 정, 포인터 변의 정, malloc 함수, fflush() 함수, getchar() 함수, 메모리의 heap stack 영역, (int)a와 *(*(int a))의 차이, 포터의 OS별 크기(DWORD 크기 따라다. 32bit/64bit),lass='line-anchor' id='line-97'>an>
    해봐야 할 것 - 디버, 가인자수 조, 복. - n>s='nonexistent' rel='nofollow' href='/wiki.php/%EC%9D%B4%EC%84%B1%ED%9B%88'>이a>성훈</span>an class='line-anchor' id='line-98'>

2.6.2n class='dot'>.pan> 과제 class='perma' href='#s-2.6.2'>¶;>
"sc-25">
  • 개인적으로 재 시에서 과제를 낸다 C의 법을 히기 위한 제를 비할 것 같데 환가 현재 시에서 C 문법 나름로 잘 쓰는 큼 그렇게까지 무해서 제를 낼 필는 없 않을까 싶. 사실 언제부터 떤 과제들을 내야 지 정확히 이 안 잡히는 것도 지만... - ref='/wiki.php/%EC%84%9C%EB%AF%BC%EA%B4%80' title="서민관" >서민관

2.6.3n class='dot'>.pan> 후기 class='perma' href='#s-2.6.3'>¶;>
"sc-26">

2.7.2n class='dot'>.pan> 후기 class='perma' href='#s-2.7.2'>¶;>
"sc-29">
포인터에 대 잘 배웠네요 class='line-anchor' id='line-115'></span> /> 포인터변수가 가지 값과 *, &산자 사용법을 (은 익혔는데 아직 긴가가하..) 배웠구요..lass='line-anchor' id='line-116'>pan>
> malloc과 fflush 수에 대해 시 정하게 짚을 있어 좋았구요an class='line-anchor' id='line-117'>
<br /> 특히 heap과 stack에 대한 깊 이해 있었요.an class='line-anchor' id='line-118'><br /> 그래도 역시 념만 충실한 상태 좀 많은 예를 다볼 수 있었면 좋네요<span class='line-anchor' id='line-119'>
>
그리고 밑의 제... 이중 인터뉰ㅋㅋㅋㅋㅋㅋ - pan>ass='nonexistent' rel='nofollow' href='/wiki.php/%EC%9D%B4%EC%84%B1%ED%9B%88'>이성훈pan> class='line-anchor' id='line-120'></span> />

2.7.3n class='dot'>.pan> 과제 class='perma' href='#s-2.7.3'>¶;>
"sc-30">
  • 배열 아서 집기 - 배열 주소값을 자로 아서 뒤집는 함수.<span class='line-anchor' id='line-122'>>

// 함수 선언
void reverseArr(int **arr, int arrLen);

// 함수 사용
int arr[10];
reverseArr(&arr, 10);

2.8.2n class='dot'>.pan> 후기 class='perma' href='#s-2.8.2'>¶;>
"sc-33">
  • 포인터 변수 값을 주어 기화 려면 어떻게 해야 는가(malloc 수의 용)와 메모 해제(free 함)에 한 이기를 했다. 리고 배열과 포인에 대 이야기를 는데, 배열도 결국 속된 메모리를 잡다는 에서 포인터와 같 값의 참조도 포인 변수 똑같이 할 있다는 것 다뤘. 그 에는 포인터 변수(열)를 인자 받는 함수를 만드 법을 배우고, 배열 인자로 받 때는 반드시 길이 관리줘야 한다는 이야를 했. - href='/wiki.php/%EC%84%9C%EB%AF%BC%EA%B4%80' title="민관" >서민n class='line-anchor' id='line-137'>
  • malloc 수 = 에 배되는 메모리, 변수 타입에 따라 당된 값에 라 생는 메모리(수?)an class='line-anchor' id='line-138'><br /> Pointer 배열 = 둘은 결국 다.n class='line-anchor' id='line-139'>
    배열(인터) 인자로 받 함수 = 주소, 거 | 거ass='line-anchor' id='line-140'>
    an>
    오늘은 다소 든 개념들이었습니다. - pan>ass='nonexistent' rel='nofollow' href='/wiki.php/%EB%B0%95%ED%99%98%ED%9D%AC'>박환희pan> class='line-anchor' id='line-141'></span> />

2.11 class='dot'>.an> </span>6차-환 (2012-4-9) + 7차-환희 (2012-4-9) class='perma' href='#s-2.11'>¶</a>

<div id="sc-40">

2.11.2an class='dot'>.span> class='perma' href='#s-2.11.2'>¶;>
"sc-42">
  • 시험기간에 희 후를 적어둔 이를 일 째로 잃버렸니다. ㅠㅠㅠㅠㅠㅠㅠㅠㅠclass='line-anchor' id='line-169'>span>
    />
  • 정모 에 두 시간, 모 끝나고 시간 걸린 정말 새싹이었습니다. ;;;; 처 계획로는 재현이나 성이랑 슷하 구조체 문과 사에 대해서 단하 다룰 생각이었는데 환희 왜 구조체가 필요지에 한 이야기를 하면 이야가 많이 다 방향로 흘러갔네요. 일 구조체가 요한 유를 추상화의 관에서 상화 한 타(구조)과 입에 한 연산(함)을 제공하기 위해라고 을 했는데 래도 접 피부에 닿았지 어떨지는 좀 걱입니. 역 이런 부분은 직접으로 험을 해 보 않으 것 같네요. 시스템(도관 관 프로그램이나 은 시스 등) 재현, 성이랑 이서 쪼개서 만들 보게 하거나 하는 찮지 을까 싶습니다. 나에 시켜봐야지. - href='/wiki.php/%EC%84%9C%EB%AF%BC%EA%B4%80' title="민관" >서민an class='line-anchor' id='line-170'><br />

2.12.2an class='dot'>.span> class='perma' href='#s-2.12.2'>¶;>
"sc-45">
  • 경험했던 일 : 함수 만드 이유. 슈도 코드의 편리. 포인터와 조체 습.an class='line-anchor' id='line-179'><br /> 해 봐 할 것 : reverse(number) 정의 - 수 배을 뒤집는 class='line-anchor' id='line-180'></span> /> 좋았던 점 : 험 때에 희...미...했던 억이 살아 좋았고, 함에 대한 이도가 아진 듯해서 좋았. 오늘은 C스움이 많이 껴져 흡족다. 공다 걸 해서 보이 느진다. - n>lass='line-anchor' id='line-181'>pan>
    >
  • 함수와 구조 문법 대한 복습 '함수형 프그래'에 대해서 루었. 복습은 시이 끝고 잊어버렸을 테까 한 것이고 중요 것은 뒤쪽에서 했 함수 프로그래밍 부분다. 전체적인 내용 프로램을 의미단위(함)로 쪼개는 사코를 적 함수의 껍기를 든 후에 내물을 워 나가는 식이다. 개인적으로 내 싹에루고 었던 내용의 절반 해당는 부분이라 고민 많이 했는데, 그래 전하기는 전한 것 같. 다음으로는 가르야 할 나머지 절반 설계 대한 실습 좀 해 봐야 다. - <a href='/wiki.php/%EC%84%9C%EB%AF%BC%EA%B4%80' title="서민관" >서민pan class='line-anchor' id='line-182'>

2.12.3an class='dot'>.span> class='perma' href='#s-2.12.3'>¶;>
"sc-46">
  • 아래와 같은 수를 만듭니다. class='line-anchor' id='line-184'></span> />
  • 꼭 reverse 함수 하나 만들 필요는 없습다.n class='line-anchor' id='line-185'>
    오늘 던 내을 생각하면서 함를 만는 도중에 신이 요하고 생각하는 부분ass='line-anchor' id='line-186'>an>
    추가적으로 수를 들어 써도 좋습다. 오히려 더 작은 함들로 누는 편을 천합다.n class='line-anchor' id='line-187'>


// 정수를 인로 주 숫자를 뒤어서 려준.
// 123을 넣으 321을 리턴. 100을 넣으면 1 리턴. 120을 넣으면 21을 턴.
int reverse(int number);

2.13.2an class='dot'>.span> class='perma' href='#s-2.13.2'>¶;>
"sc-49">
  • Callback(winapi 야기면서) + winapi.co.krn class='line-anchor' id='line-200'>
    문자열과 관된 함 5가. + 실.class='line-anchor' id='line-201'>span>
    /> 오늘은 함수 봐서 그냥 ... 그구나 그런 낌.n class='line-anchor' id='line-202'>

    배운다는 것 다는 암기에 가까 느낌었다. -
    n>lass='line-anchor' id='line-203'>pan>
    >
  • 문자열과 관된 유한 함수들과 class='nonexistent' rel='nofollow' href='/wiki.php/CallBack'>CallBackspan>의 개념과 구조 활용 배웠다. class='line-anchor' id='line-204'></span> /> 어려운 느낌 들기 하지만 아도 해 볼 만 다.an class='line-anchor' id='line-205'><br /> 점점 C어가 function 위주의 프로래밍라는 이 이하게 된다.pan class='line-anchor' id='line-206'>
    구조체 예제 좀 있으면 겠다. - <a class='nonexistent' rel='nofollow' href='/wiki.php/%EC%9D%B4%EC%84%B1%ED%9B%88'>이an>class='line-anchor' id='line-207'>span>
    />
  • 전체적으로 자열 문자을 다루는 수만 초점 맞춰서 수을 진했습다. 런데 무래간에 지 않게 진이 늘졌던 시간이 아니나 싶니다. 사실 자열 함수들은 단 함수만큼 인자들을 보 쓰는 것에 숙하면 알서도 보고 수준긴 한데, 그도 다들 그 것을 찾아서 써 보나 한 경험 별로 없는 큼 한 번쯤 런 함들을 찾아서 쓰는 간을 가지는 것도 쁘지 않지 을까 었는 생각보다 진행 늘어졌군요. 단순 설명만 이졌기 문인. 그도 이 시간에 굳 문자과 관련 함를 다 것은 C언어서 문자열을 단순 char의 *가 아닌 하의 타으로 보고 와 관된 연산(함)을 제공했다는 것 한 번쯤 생해봤면 합다. - 서민관

2.13.3an class='dot'>.span> 제 - 린더 만들기 ='perma' href='#s-2.13.3'>&#xB6;

  • Calender.h 파일 - 만들야 할 함수. 더 려도 관 없습니다.ass='line-anchor' id='line-210'>an>

// 한 의 달을 출력하는 함수니다.
void printCalender(int nameOfDay, int year, int month);
// 달의 첫 날 요일(nameOfDay)과 마지막 의 수 받아서 1~endDayOfMonth까지 력합다.
void printDate(int nameOfDay, int endDayOfMonth);
// 달의 1일 앞의 부에 빈 요일 만큼 ('\t') 넣습니다.
void printFirstTab(int nameOfDay);
// 달력 첫 머 부분(월, 년도, 한 줄, 요 표시)을 출합니.
void printHeader(int year, int month);
// 다음 달의  날의 요일 반환니다.
int calculateNameOfNextMonthFirstDay(int nameOfDay, int year, int month);
// 해당 달의 지막 날의 일을 환합다.
int calculateNameOfLastDay(int nameOfDay, int year, int month);
// 윤달 체크.
bool isLeapYear(int year);
// 각 의 마막 날 수를 환합다.
// 단순한 switch-case문으로 루어 있으, 2월 대해서는 달 체를 합니다.
int endDayOfMonth(int year, int month);
// 각 일의 자를 받아서 문자 값을 반환합니다. (ex. 0-"Sun", 1-"Mon" ...)
// 단순한 switch-case문으로 루어 있습다.
char *printMonthName(int i);
  • main.cpp 파일an class='line-anchor' id='line-233'><br />

#include <stdio.h>
#include "Calender.h"

int main(int argc, char *args[]) {
	// year 요일(nameOfDay)을 입력받는 부분.
	int year = 0, nameOfDay = 0;
	printf("Enter the year : ");
	scanf("%d", &year);
	printf("Enter the name of day(0:sun ~ 6:sat) : ");
	scanf("%d", &nameOfDay);

	// 1~12을 출력하는 부분.
	for ( int month = 1; month <= 12; month++ ) {
		printCalender(nameOfDay, year, month);
		nameOfDay = calculateNameOfNextMonthFirstDay(nameOfDay, year, month);
	}

	return 0;
}
  • sample output - 1부터 12월까. 출을 예게 하고 싶면 탭('\t')을 쓰면 니다.<span class='line-anchor' id='line-255'>>

                 January, 2012
-------------------------------------------------
  Sun    Mon    Tue    Wed    Thu    Fri    Sat
   1      2      3      4      5      6      7
   8      9     10     11     12     13     14
  15     16     17     18     19     20     21
  22     23     24     25     26     27     28
  29     30     31

2.13.4an class='dot'>.span> class='perma' href='#s-2.13.4'>¶;>
"sc-51">
  • 왜 strcat(str1, str2)를 후에 str1을 프린트했는데 이상 출력 나오는가.pan class='line-anchor' id='line-270'>
    People p;와 strcat의 사에 문제가 습니. p를 기화(People p = {0};) 지 않고 사하면pan class='line-anchor' id='line-271'>
    p.name이 쓰레 값으 채워지는 같습다. 래서 strcat을 사용하면 p.name의 뒷분(p.name99
    pan>의 부분)에 "홍동" 용이 습니.class='line-anchor' id='line-272'>span>
    /> 이런 황을 하기 위해서는 처에 p를 초기 하고 사용하거나 memset(p.name, 0, sizeof(char)*100); 하는 방법이 있습다.n class='line-anchor' id='line-273'>



#include <stdio.h>
#include <string.h>

typedef struct People{
	char gender;
	int age;
	char name[100];
	char real_name[100];
} People;

int main()
{
	char str1[100] = "abc";
	char str2[100] = "aaa";

	People p;
	strcat(p.name, "길동");

	strcat(str1, str2);

	printf("%s", str1);

	getchar();
	return 0;
}

2.14 class='dot'>.an> </span>10차(2012-5-22) - 성훈, 환희 class='perma' href='#s-2.14'>¶

2.14.1an class='dot'>.span> 업내 ss='perma' href='#s-2.14.1'a>

iv id="sc-53">
  • 예제를 조금 다루어 봤면 하 얘기와 구체를 보고 싶다 얘기 있어class='line-anchor' id='line-304'>span>
    /> 아예 조체 쓸 만한 예를 만어 봤습니다.ass='line-anchor' id='line-305'>an>
  • 전체적으로 대로 성하 프로그램을 만들 본다 점에 의의 있을 것 같니다.<span class='line-anchor' id='line-306'>>
    그리고 addAccount()와 deleteAccount()는 이 이 수업 위한 하나 포인가 될 것입다.n class='line-anchor' id='line-307'>

Account.h
#include <stdio.h>

typedef struct Account {
	char *name;
	int money;
} Account;

typedef struct AccountArray {
	struct Account **accounts;
	int currentAccountNumber;
	int maxLength; // 배열 사용 때는 길이 관리는 구조체를 만들서 쓰 편하다.
} AccountArray;

Account *createAccount(char *name); // Account에 깔하게 이름을 할당기 위서는 문자열 함수 필요 것이다.
AccountArray *createAccountArray(int maxLength);
void addAccount(AccountArray *accountArray, char *name);
bool isFull(AccountArray *accountArray); // 열이 다 차 어떻 하면 좋을??????
AccountArray *extendArray(AccountArray *before); //  찬 배열은 로 확을 해 주어 합니.
void deleteAccount(AccountArray *accountArray, char *name); // 배열의 중간 소 삭제? 중에 구멍만  뚫어면 되나?
void deposit(AccountArray *accountArray, char *name, int money); // accountArray 내부에서 이으로 교할 필요가 있겠.
void withdraw(AccountArray *accountArray, char *name, int money);

void addAccountMenu();
void deleteAccountMenu();
void depositMenu();
void withdrawMenu();

main.cpp<span class='line-anchor' id='line-339'>>
#include <stdio.h>

#include "Account.h"

int main(int argc, char *argv[]) {
    int select = 0;
	// 추적인 수들 필요할 것로 예.

    while ( true ) {
        printf("select menu : ");
		printf("1: 계 추가\n");
		printf("2: 계 삭제\n");
		printf("3: 입\n");
		printf("4: 출\n");
        scanf("%d", &select);

        switch ( select ) {
		case 1:
			addAccountMenu();
			break;
		case 2:
			deleteAccountMenu();
			break;
		case 3:
			depositMenu();			
			break;
		case 4:
			withdrawMenu();
			break;
                default:
                        break;
		}
    }

	return 0;
}

2.15 class='dot'>.an> </span>11차(2012-5-23) - 성훈, 환희 class='perma' href='#s-2.15'>¶

2.15.1an class='dot'>.span> 업내 ss='perma' href='#s-2.15.1'a>

iv id="sc-56">
////////////////////////////////////// 기본 타입, 기본 입 + 인터
char a; // a의 입? 1. 메모리에 a 그려보기.
a = ?? // 적절 값으 초기화 해 기.
int b; // b의 타입? 1. 모리 b 그보기.
b = ?? // 적절 값으 초기화 해 기.

char c[10]; // c 타입?, 1. 선과 동시에 0로 초기화  보기., 2. 반문을 이용해서 원마다 기화 해 보., 3. c[0]의 타입?
char *d; // d의 입? char 10개 분량의 배열 선언 동시에 초화 해 보기.

// c와 d를 각 메모에 그려보기. 중요.


??? // []를 이해서 c의 세 째 원소에 근해 기.
??? // 능한 법으 d의  번째 원소 접근 보기.
??? // 능한 법으 c의  번째 원소 접근 보기.
// array[0] == *(array + 0) 배열나 포터나 해당 소에 한 접근이라는 점서는 일하 접근할 수 다.



//////////////////////////////////////// 사자 정의 타, 사용자 정 타입 + 포인
Person p; // p의 타입? 1. 메모에 p 모양 그려보기.
??? // p 내용물에 근해기.

Person pArr[10]; // pArr의 타입? 1. 메모리에 pArr의 모양 그보기.
??? // pArr의 0째 내물에 접근해보기

Person *p2; // p2 타입? 1. 메리에 p2의 모양 그보기.
??? // p2 초기 해 보기.
??? // p2의 내물에 근해기.



Person *ppa[10] // ppa의 입? 1. 메모에 ppa 모양 그려기., 2. ppa[0] 타입? 3. ppa[0] 초기기. 4. ppa[0]의 내용에 접해 보기.

Person **ppb // ppb의 타? 1. 모리 ppb의 모양 려보., 2. ppb[0]의 입? 3. ppb[0] 기화 해 보., 4. ppb[0]의 용물 접근해 보.

2.16 class='dot'>.an> </span>12차(2012-7-19) <a class='perma' href='#s-2.16'>¶;>
"sc-58">

2.16.1an class='dot'>.span> 업내 ss='perma' href='#s-2.16.1'a>

iv id="sc-59">
  • AccountArrayspan>와 관련된 함수 만들.class='line-anchor' id='line-420'>span>
    />
  • 왜 createAccount(char *name)은 Account의 *를 반하는.lass='line-anchor' id='line-421'>pan>
    >

Account makeAccount(char *name) {
	Account account;
	account.money = 0;
	account.name = (char *)malloc(sizeof(char) * (strlen(name)+1));
	strcpy(account.name, name);

	return account;
}

void addMoney(Account account, int money) {
	account.money += money;
}
그냥 Account를 반환하게 만 다음 함수들을 써 면 차이를 수 있습니다.ass='line-anchor' id='line-436'>an>
Account 그냥 넘겨주게 되 call-by-value로 Account 복사본을 지고 money를 가시기 때문에an class='line-anchor' id='line-437'>
<br /> 원본 Account에 아무런 변가 없니다.
  • extendArray 등의 함수 용의 불편함.ass='line-anchor' id='line-439'>an>

2.17 class='dot'>.an> </span>13차(2012-7-20) <a class='perma' href='#s-2.17'>¶;>
"sc-60">

2.17.1an class='dot'>.span> 업내 ss='perma' href='#s-2.17.1'a>

iv id="sc-61">

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef int Data;

typedef struct Node {
    Data data;
    Node *nextNode;
} Node;

typedef struct LinkedList {
    int length;
    Node *headNode;
} LinkedList;

LinkedList *createList();
Node *createNode(Data data);
void deleteList(LinkedList *linkedList); // LinkedList까지 제.
void addData(LinkedList *linkedList, Data data); // LinkedList에 Data를 가 Node 가.
void removeData(LinkedList *linkedList, Data data); // 해당는 Data를 가 Node 제.
Node *getData(LinkedList *linkedList, int position); // 해당는 index를 가진 Node 반환.
void clearList(LinkedList *linkedList); // LinkedList Node 삭제.
void printList(LinkedLIst *linkedList);

2.17.2an class='dot'>.span> 드들 >

v id="sc-62">
  • 환희an class='line-anchor' id='line-474'><br />


  • 성훈an class='line-anchor' id='line-477'><br />

#include "LL.h"

LinkedList *createList(){
	LinkedList *res;
	res = (LinkedList *)malloc( sizeof(LinkedList) );
	(*res).headNode = NULL;
	(*res).length = 0;	
	return res;
}
Node *createNode(Data data){
	Node *res;
	res = (Node *)malloc( sizeof(Node) );
	(*res).data = 0;
	(*res).nextNode = NULL;
	return res;
}
void deleteList(LinkedList *linkedList){
	clearList(linkedList);
	free(linkedList);
}
void addData(LinkedList *linkedList, Data data){
	Node *node = createNode( data );
	Node *temp = linkedList->headNode;
	for(;temp->nextNode != NULL;){
		temp = temp->nextNode;
	}
	temp->nextNode = node;
}
void removeData(LinkedList *linkedList, Data data){
	int onoff = 0;																		//for duty of switch
	Node *remove = linkedList->headNode;
	if( remove->data == data ){
		free( remove );																	//If the object is headNode
		onoff = 1;
	}
	if( onoff == 0 &amp;& remove->nextNode->data == data ){
		free( remove->nextNode );														//If the object is the nextNode of headNode
		onoff = 1;
	}
	for(; onoff == 0 &&; remove->nextNode->data != data;){								//...
		remove = remove->nextNode;
	}
	remove->nextNode = remove->nextNode->nextNode;										//	remove   remove-n   remove-n-n
	free(remove->nextNode);																//	remove ~ remove-n-n , free remove-n
}
Node *getData(LinkedList *linkedList, int position){
	Node *get = linkedList->headNode;
	for( int i = 0 ; i < position ; i++ ){
		get = get->nextNode;
	}
	return get;
}
void clearList(LinkedList *linkedList) {
	Node *now = (*linkedList).headNode;
	Node *next;
	for( ; (*now).nextNode != NULL ; ){	//now의 다음 있는안 반		next = (*now).nextNode;			//next now의 다음
		free( now );					//now를 free
		now = next;						//next now로 당김
	}
	free( now );						//now를 free
}
int lengthOf(LinkedList *linkedList){
	int length = 0;
	Node *temp = linkedList->headNode;
	for( ; temp->nextNode != NULL ; length++ ){
		temp = temp->nextNode;
	}
	return length;
}
void printList(LinkedList *linkedList){
	Node *temp = linkedList->headNode;
	for( ; temp->nextNode != NULL ; ){
		printf("%d\t", temp->data);
		temp = temp->nextNode;
	}
	printf("\n");
}

2.17.3an class='dot'>.span> class='perma' href='#s-2.17.3'>¶;>
"sc-63">
  • 더미 드의 용 이유, 예.class='line-anchor' id='line-559'>span>
    />

2.18 class='dot'>.an> </span>2012-7-30 class='perma' href='#s-2.18'>¶

2.18.1an class='dot'>.span> class='perma' href='#s-2.18.1'>¶;>
"sc-65">
int main() {
	Stack *stack = createStack();
	assert(stack->elementNumber == 0);
	assert(stack->head == NULL);

	push(stack, 10);
	assert(stack->elementNumber == 1);
	assert(peek(stack)->data == 10);

	push(stack, 20);
	assert(stack->elementNumber == 2);
	assert(peek(stack)->data == 20);

	assert(pop(stack)->data == 20);
	assert(stack->elementNumber == 1);

	Node *result = pop(stack);
	assert(result->data == 10);
	assert(isEmpty(stack));

	return 0;
}

2.19.1an class='dot'>.span> class='perma' href='#s-2.19.1'>¶;>
"sc-67">
  • Map in C - 어떻든 클래스 내를 보려고 정 별 짓을 다 다. 드를 고 싶으면 href='/wiki.php/%EC%84%9C%EB%AF%BC%EA%B4%80' title="민관" >서민 가서 것.pan class='line-anchor' id='line-589'>


Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:48
Processing time 0.0957 sec