[c++] 문자열 길이 확인하는 방법

#include #include

int main() { std::string str = “Hello, World!”; int length = str.length(); std::cout « “The length of the string is: “ « length « std::endl; return 0; }


C++에서 문자열의 길이를 확인하는 가장 간단한 방법은 string 클래스의 `length` 함수를 사용하는 것입니다. 이 함수는 문자열의 길이를 반환합니다.

```markdown
## References
- C++ string length: https://www.cplusplus.com/reference/string/string/length/