문자열 길이 구하는 함수
strlen
헤더 파일 사용 목적 문자열의 길이를 조사 (마지막 NULL은 길이에 들어가지 않는다) 프로토타입과 매개변수 size_t strlen(const char *str); 1. const char *str = 길이를 조사할 문자열 함수의 원리 이해를 돕기 위해 같은 동작을 하는 함수를 만든 것입니다. size_tft_strlen(const char *str) { size_tcount; count = 0; while (*str) // str이 NULL이 나오기 전까지 { str++; count++; // count를 늘려나감 } return (count); // count를 반환 } 사용 예시 #include #include intmain(void) { char*str = "abcde"; intlength; l..