What is the difference between a Character Array and a String?

后端 未结 10 1083
眼角桃花
眼角桃花 2020-12-10 11:49

Spending my time on high level languages it suddenly occurred to me that I did not know the difference between a Character Array and a String. I think they are the same thin

10条回答
  •  囚心锁ツ
    2020-12-10 12:28

    In C, a string is an array of characters terminated by a null character(\0) but

    In C++, a string is a class and we use its object and there is no null character at the end but an array of characters contains null character at the end.

    Also, we can use operators with the string object in C++.

提交回复
热议问题