Saturday, May 22, 2010

In C++, what's the term 'string' mean?

Please be as descriptive in English as possible I'm new at this stuff. Thanks :).

In C++, what's the term 'string' mean?
string or string functions?








String functions are used in computer programming languages to manipulate a string or query information about a string (some do both).





Most computer programming languages that have a string datatype will have some string functions although it should be noted that there may be other low level ways within each language to handle strings directly. In object oriented languages, string functions are often implemented as properties and methods of string objects. In both Prolog and Erlang, a string is represented as a list (of character codes), therefore all list-manipulation procedures are applicable, though the latter also implements a set of such procedures that are string-specific.





The most basic example of a string function is the length(string) function. This function returns the length of a string literal.





eg. length("hello world") would return 11.





Other languages may have string functions with similar or exactly the same syntax or parameters or outcomes. For example in many languages the length function is usually represented as len(string). The below list of common functions aims to help limit this confusion.
Reply:Strings are also dynamic in nature. With a normal character array, once you hit the end, you're done. With the string, you can just keep appending characters to it, and it allocates storage for them dynamically so you can hold as many as you want.





The [ ] operators are overloaded so you can treat it like a normal character array and access specific elements.
Reply:It is an array of characters. Nothing more, nothing less.





They just made this commonly used construct into a new class type called "string" which can be defined and used much easier than creating an array yourself.
Reply:group of characters....


characters- single letter, number or symbol....





=D

forsythia

No comments:

Post a Comment