Sunday, May 10, 2009

What are the major differences between C strings and the string class?

In C, a 'string' is a data type, like an integer or boolean. String variables are stored as sequences of unsigned 16-bit (2-byte) numbers ranging in value from 0 through 65535. Each number represents a single Unicode character. A string can contain up to approximately 2 billion (2 ^ 31) Unicode characters.





In object oriented programming, (C++) a class is a data type that contains 'fields' and 'methods'. Fields describe the class, ie: color, text, name, etc. Methods do something, like print, clear, append, etc. The string class is a class built by Microsoft that comes with C++. It has methods (ie append, concat) and fields (ie length, value) that are useful when dealing with strings.

What are the major differences between C strings and the string class?
I would have to say that Cstrings are better than classes


No comments:

Post a Comment