C++ Drived data types
Array
Function
Pointers
References
Arrays
The application of arrays in c++ is similar to c programming language. The only exception(error) is the way character arrays are initialized . when initializing a character array in ANSI C language, the compiler will allow us to declare the array size as the exact(correct) length of the string constant . for example
Drived Data types Arrays The Array in c++ are similar to the C language. For example
string[5]="nitish"; is valid in ANSI C.
|
it assumes that the programmer intends to leave out the character \0 null in the definition.
but in c++ the size should be one longer than the number of characters in the string
Functions
function have major changes in c++ programming. while some of these changes are simple, others are require a new way of thinking when organizing our programs. many of these modification and improvements were driven by the requirements of the object oriented concept of c++, some of these were introduced to make the c++ program more reliable and readable. all the features of c++ functions are discuss
pointers
pointers are declared and initialized as in c language
example
*iptr;
iptr=&y;
*iptr=10;
|
c++ language adds the concept of the constant pointer and pointer to a constant
we can not modify the address that ptr1 is initialized to
ptr2 is declared as pointer to a constant. it can point to any variable of correct type, but the contents of what it points to cannot be changed
pointer are extensively used in c++ for memory management and achieving polymorphism