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( string ) is : "
<< static_cast( string ) << '\n'

// 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(string) is : "
<< static_cast( string ) << '\n'
<< "Value of static_cast(string) is : "
<< static_cast( string ) << '\n'
<< "Value of static_cast(string) is : "
<< static_cast( string ) << '\n'
<< "Value of static_cast(string) is : "
<< static_cast( string ) << '\n'
<< "Value of static_cast(string) is : "
<< static_cast( string )
*/
<< endl;
} // end main
```
Value of string is : test
Value of static_cast( string ) is : 0046C080

Computer Science & Information Technology

You might also like to view...

A cell value that depends on the value in another cell is known as a(n) ________ of that cell

A) dependent B) delimiter C) precedent D) subtotal

Computer Science & Information Technology

A(n) __________ is used to disseminate information that an organization wishes to publish.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Websites that allow users to communicate with each other using text, audio, video, whiteboard, and shared files are called _____ workspaces.

A. collaborative B. cloud C. home office D. community

Computer Science & Information Technology

Briefly describe the Compatible Module selection for electronic keying.

What will be an ideal response?

Computer Science & Information Technology