C/문법
C 재귀 호출(재귀 함수)
더보기 # include void my_func(int n); int main(){ my_func(1); return 0; } void my_func(int n) { printf("Level %d, address of variable n = %p\n",n,&n); // 주소 달라짐 my_func(n+1); // 무한 호출시에는 재귀 호출을 사용하지 않는다. 스택에 부하가 가기 때문. // 스택이 다 차면 강제적으로 종료 // 재귀 호출 시에는 조건문 사용. // if(n < ?) my_func(n+1); } 더보기 # include void my_func(int n); int main(){ my_func(1); return 0; } void my_func(int n) { printf("Level %d, ..
2020. 7. 22. 21:57
최근댓글