2014. 5. 22. 15:07


헤더 string.h

형태 size_t strlen( const char *str)

인수 char *str 길이를 구할 문자열

반환 문자열 길이를 바이트 단위로 반환합니다.


#include <stdio.h>

#include <string.h>

int main()

{

    char * a = "apple";

    printf ("length = %d,  %s \n" , strlen(a), a);

}

$ ./a.out

length = 5,  apple


Posted by Triany