const 관련 질문있습니다.
루리
2023.04.01
const 관련 질문const질문 내용 :
#include stdio.h
#include ctype.h
int count_word( const char *s);
int main(void)
{
printf(word is %d\n, count_word(foundation flash mx));
return 0;
}
int count_word( const char *s)
{
int i, wc=0, waiting=1;
for(i=0; s[i] != null; ++i)
if(isalpha(s[i]))
{
if(waiting)
{
wc++;
waiting = 0;
}
}
else
waiting = 1;
return wc;
}
----------------------
이 소스에서 사용자 함수 int count_word(const char *s);에서 const를 사용하는 이유를 알고싶습니다.
warring 메시지가 나오지만 실행결과 이상이 없더라구요 ^^;;