C++ strlen()

Jmnote (토론 | 기여)님의 2019년 4월 10일 (수) 23:25 판

1 개요

C++ strlen()
C++ 스타일
#include <iostream>
#include <string>
using namespace std;
int main() {
    string s = "abc";
    cout << s.length() << endl; // 3
}
C 스타일
#include <iostream>
#include <cstring>
using namespace std;
int main() {
	cout << strlen("abc") << endl; // 3
}
#include <stdio.h>
#include <string.h>
int main() {
    printf("%d", strlen("abc")); // 3
}

2 같이 보기

3 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}