字符串文字和字符串之间的区别也在于可变和不可变? [英] What is the difference between String literals and string also in term of mutable and immutable ?

查看:95
本文介绍了字符串文字和字符串之间的区别也在于可变和不可变?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

字符串文字和字符串之间的区别也在于可变和不可变吗?



假设我们有

string s = Prashant Gupta;



这是字符串文字或字符串;

What is the difference between String literals and string also in term of mutable and immutable ?

Suppose we have
string s = "Prashant Gupta";

This (s) is String Literals or string ;

推荐答案

s 是一个 std:string 对象(这是一个'可变'字符串)初始化 string literal('immutable'字符串)。
s is a std:string object (that is a 'mutable' string) initialised with a string literal (a 'immutable' string).


这篇关于字符串文字和字符串之间的区别也在于可变和不可变?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆