Quantcast
Channel: User CPlus - Programming Language Design and Implementation Stack Exchange
Viewing all articles
Browse latest Browse all 66

What are the advantages of strings and character arrays being different?

$
0
0

In many languages such as Java, strings and character arrays are distinct types. In Java one must use toCharArray() in order to use array semantics on strings.

In C, strings and character arrays are more or less the same. A C string is just a character array with a null terminator. Otherwise there is no internal distinction between them.

What are the advantages or disadvantages of strings being distinct types from character arrays?


Viewing all articles
Browse latest Browse all 66

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>