Skip to content

Latest commit

 

History

History
58 lines (40 loc) · 1.09 KB

File metadata and controls

58 lines (40 loc) · 1.09 KB

strlen

  • cstring[meta header]
  • std[meta namespace]
  • function[meta id-type]
namespace std {
  size_t strlen(const char* s);
}
  • size_t[link /reference/cstddef/size_t.md]

概要

文字列の長さを取得する。

効果

sが指す文字列の長さを求める。

戻り値

sが指す文字列の、終端のヌル文字より前にある文字の個数を返す。

備考

  • この関数は、フリースタンディング処理系でも使用できる。

#include <cstring>
#include <iostream>

int main()
{
  std::cout << std::strlen("hello") << std::endl;
}
  • std::strlen[color ff0000]

出力

5

バージョン

言語

  • C++98

関連項目

参照