Write a program that prints pointer values, using casts to all the integer data types. Which ones print strange values? Which ones cause errors?
What will be an ideal response?
```
#include
using namespace std;
int main()
{
// string to cast into integer formats
char *string = "test";
// display data stored in string and
// address of string using static_cast
cout << "Value of string is : " << string << '\n'
<< "Value of static_cast
<< static_cast
// The following generate errors.
// reinterpret_cast will allow this type of casting.
// See Ch. 24 for a discussion of reinterpret_cast.
/* << "Value of static_cast
<< static_cast
<< "Value of static_cast
<< static_cast
<< "Value of static_cast
<< static_cast
<< "Value of static_cast
<< static_cast
<< "Value of static_cast
<< static_cast
*/
<< endl;
} // end main
```
Value of string is : test
Value of static_cast
You might also like to view...
After you edit a source Flash file, Dreamweaver automatically republishes the movie as a(n) ____ file.
A. FLA B. SWF C. FLS D. SWA
Java bears a superficial resemblance to C++.
Answer the following statement true (T) or false (F)