char hello[] = "hello";
int hello_len = strnlen_s(hello, sizeof hello);
std::cout << hello_len << std::endl;
std::cout << sizeof(hello) << std::endl;
for (int i = 0; i < hello_len; i++) {
std::cout << hello[i] << std::endl;
if( hello[i] == '\0' ){
std::cout << "end!" << std::endl;
}
}
strnlen_s 으로 문자열 크기 구하니까
널문자(\0) 뺀 크기로 나오네??
sizeof로 하니까 포함되서 나오고..
그럼 반복문 max값에 sizeof(문자열) 넣고 돌리는게 정석?
빼고하세여
아니 문자열 안 쓰는게 정석이야 - return 0;
되서->돼서 (되어 = 돼임) [리듬 맞춤법 봇♬]