Chinese Life Q&A

字符和字符串的区别

字符和字符串的区别主要有以下几点:

1、字符是单个字符,而字符串是由多个字符组成的集合。

2、在计算机中,字符用单引号表示,而字符串用双引号表示。

3、在给数组赋初值时,字符需要在结尾加上“\0”,而字符串不需要。

4、在屏幕上打印一个字符时,使用“%c”占位符;而打印一个字符串时,使用“%s”占位符。

5、在存储方式上,“字符”占据一个字节,而“字符串”占据多个字节。

赞(0)
Copyright: The content of this article from the network, if there is any infringement, please write to inform the
Article Title.字符和字符串的区别The
Article Link:https://www.xiaowenxiaoda.cn/en/wenda/661.html
Contact: 652779065@qq.com
分享到

commentaries sofa-buying

You must be logged in before commenting!

 

sign in

Retrieve password

enrollment

en_USEnglish