C++教程
C++控制语句
C++函数
C++数组
C++指针
C++对象
C++继承
C++多态
C++抽象
C++常用
C++ STL教程
C++迭代器
C++程序

C++ String max_size()

C++ String max_size()

此函数返回由于已知系统字符串可以达到的最大长度。

语法

考虑字符串str。语法为:
str.max_size();

参数

它不包含任何参数。

返回值

此函数返回最大值字符串可以达到的长度。

示例1

让我们看一个简单的示例。
#include<iostream>
using namespace std;
int main()
{
string str = "Hello world";
cout<<"String is :" <<str<<'\n';
cout<<"Maximum size of the string is :"<<str.max_size();
return 0;
} 

昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4