C언어 수업정리/4월 수업정리
4월 23일 연결리스트 다른방법
송시혁
2013. 4. 23. 14:37
예제 10-4
#include <stdio.h>
|
1. temp = list; 에서 temp 또한 malloc을 가르킨다.
2. temp= temp-> next; 에서 temp-> next는두번째 malloc을 받고 가르킨다.
그리고 이것을 temp에 대입한다. data에 'b'를 삽입하고나서
temp -> next 다시 동적할당을 받는다.
3. temp= temp-> next; 에서 temp는 세 번째 malloc을 가르키게 된다.
이과정을 아래그림으로 표현 하였다.