programminga general overview arr is actually pointer to memory that is large enough to store intsrather than first-class array type applying to arrays is thus an attempt to copy two pointer values rather than the entire arrayand with the declaration aboveit is illegalbecause arr is constant pointer when arr is passed to functiononly the value of the pointer is passedinformation about the size of the array is lost thusthe size must be passed as an additional parameter there is no index range checkingsince the size is unknown in the declaration abovethe size of the array must be known at compile time variable cannot replace if the size is unknownwe must explicitly declare pointer and allocate memory via new[for instanceint *arr new intn ]now arr behaves like arr except that it is not constant pointer thusit can be made to point at larger block of memory howeverbecause memory has been dynamically allocatedat some point it must be freed with delete[]delete arr otherwisea memory leak will resultand the leak could be significant if the array is large built-in -style strings are implemented as an array of characters to avoid having to pass the length of the stringthe special null-terminator '\ is used as character that signals the logical end of the string strings are copied by strcpycompared with strcmpand their length can be determined by strlen individual characters can be accessed by the array indexing operator these strings have all the problems associated with arraysincluding difficult memory managementcompounded by the fact that when strings are copiedit is assumed that the target array is large enough to hold the result when it is notdifficult debugging ensuesoften because room has not been left for the null terminator the standard vector class and string class are implemented by hiding the behavior of the built-in -style array and string discusses the vector class implementation it is almost always better to use the vector and string classbut you may be forced to use the -style when interacting with library routines that are designed to work with both and +it also is occasionally necessary (but this is rareto use the -style in section of code that must be optimized for speed templates consider the problem of finding the largest item in an array of items simple algorithm is the sequential scanin which we examine each item in orderkeeping track of the maximum as is typical of many algorithmsthe sequential scan algorithm is type independent by type independentwe mean that the logic of this algorithm does not depend on the type of items that are stored in the array the same logic works for an array of integersfloating-point numbersor any type for which comparison can be meaningfully defined throughout this textwe will describe algorithms and data structures that are type independent when we write +code for type-independent algorithm or data structurewe would prefer to write the code once rather than recode it for each different type