Try this:
Code:
#include <iostream>
using namespace std;
int main()
{
char hello[] = "Hello";
char *chpoint = hello;
cout << "First with cout:" << endl;
cout << "Here's cout << chpoint : " << chpoint << endl;
cout << "Here's cout << (void *)chpoint: " << (void *)chpoint << endl;
printf("\n\nNow, with printf():\n");
printf("Here's chpoint with printf(%%s): %s\n", chpoint);
printf("Here's chpoint with printf(%%p): %p\n", chpoint);
return 0;
}
if you use cout with a variable of type char *, it is designed to print a c-style string.
If you want to print the value of a pointer, cast it to void *.
This works for me, but I don't know what type of machines you have and whether it will work for them.
Regards,
Dave