[IT] C언어 입문(14, 끝) C 전처리기(C preprocessor), 함수 포인터(function pointer) □ C preprocessor, function pointer * List Creation and Element Counting - element를 포인터를 따라가면서 카운팅... recursion 이용 int count(LINK head) { if (head == NULL) return 0; else return (1 + count(head->next)); } recursion 이용 안 함 int count(LINK head) { int cnt = 0; for(; head!=NULL; head=head->next) // head=head->next는 head가 다음 element를 포인팅하는 식 { cnt++; } return cnt; } --- LINK stringToList(char s[]) { L.. 2021. 9. 18. 이전 1 다음