char * a=0;
int * b=0;
cout<<a<<a+1;
cout<<b<<b+1;
what's wrong with it
char * a=0;
int * b=0;
cout<<a<<a+1;
cout<<b<<b+1;
what's wrong with it
You are assigning null (0) to the value of your pointers, which means they do not reference a valid memory location.
The initializations are fine. Doing pointer arithmetic on NULL pointers is wrong.
Also, cout << (const char*) assumes the operand is a valid C-style string, not a NULL pointer. If you want to print the address of the string, not the string itself, you'll need to cast it because otherwise char pointers receive special treatment.
char* a = 0;
std::cout << static_cast<void*>(a);
Nothing wrong with it.
maybe something's wrong with what you expect of this code.