关于C ++中的字符串 [英] regarding string in c++

查看:85
本文介绍了关于C ++中的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

c字符串和c ++字符串之间的基本区别是什么?我们如何在win32应用程序中使用c ++字符串.

what is the basic difference between c string and c++ string?how we use c++ string in win32 application.

推荐答案

Google是您的朋友.
http://cs.smu.ca/~porter/csc/ref/c_cpp_strings.html [^ ]
Google is your friend.
http://cs.smu.ca/~porter/csc/ref/c_cpp_strings.html[^]


Google揭示了所有...

C字符串 [ C ++字符串 [ C ++字符串参考 [
Google reveals all...

C string[^]

C++ string[^]

C++ string reference[^]


其他人的链接不错,但让我给出一个综合意见:
C字符串和C ++字符串是关于"通常用于形成书面文本的任意字符序列"的通用(甚至危害"人类原始语言")概念的约定. .

C表示将字符存储在分配了一定程度的字符数组中,并以"\ 0"字符终止序列,然后我将为您提供一组可与它们一起使用的库函数".

C ++说:让我将所有内存分配的东西包装到一个类中,然后让我给您一些此类的公共方法,以使用其内容或以与我通用算法的接口一致的方式使其内容可用提议(迭代器之类的)".
Good post of links by others, but let me give a synthetic opinion:
C strings and C++ strings are different conventions about the common (I even would hazard "human-primitive") concept of "arbitrary sequence of character commonly used to form written text".

C says "store characters in a somewhat allocated character array, terminate the sequences with a ''\0'' character, and I''ll give you a set of library functions to play with them".

C++ says "let me wrap all the memory allocation stuff into a class and let me give you some public method of this class to play with its content or to make its content available in a way that is consistent with the interface of the generic algorithms I propose (iterators and the like)".


这篇关于关于C ++中的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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