The C++ language is an extension of C and thus carries the legacy of the C language. One of the legacies is the arrays. The array is a simple structure containing a collection of homogeneous items together as a single unit. A great feature of the arrays is the ability of the programmer to manipulate the complete collection using the index value and some looping structure. Another important legacy of C is the string. The string in C is an array of characters terminated by a typical sentinel value called null (‘\n’). The C string library contains many functions for dealing with C type strings, for example, copy one string into another, comparing two strings with each other, finding out if there is a typical substring which is part of a given string etc. The arrays are part of the C++ design and they are used like they are in C. However, the C type strings are not preferred in C++ as a better form of string is provided by the C++ designers. The C++ string is basically an object of the class (which is also known as a string class) available to C++ programmers. C++ contains a new library called standard template library or STL which contains many other classes apart from the string. The string is one of the most popular classes of the STL. The string class has many advantages as compared to the C type string. We will throw some light on how the string objects are better than C type strings in this module. We will also explore two important things in this module. We will see how arrays are extended in C++ to have objects as their elements. We will also learn about how the C++ string objects are used and how one can program using the C++ string objects and their member functions.
Before we embark on the discussion of string objects, let us be clear that the C language array structure and strings are assumed to be known. If you have no idea about C arrays and strings, it is strongly recommended that you study them before attempting to learn the content of this module.
|Arrays and Strings||00:32:00|
No Reviews found for this course.
1 STUDENTS ENROLLED