+ 1
I faced with some problems about pointers.
my current knowledge say to me that Pointer value is an address that point to a memory location. so memory has a address as hex. int x = 5; int * ptrX = &x; in above, ptrX value is a hex address that point to X variable. and *ptrX return value of mentioned address . ok. every thing is clear. but in follow code: char charTest = 'b'; char * ptrC = &charTest; cout << ptrC << endl; 1. my output is not a hex address. why? and more i am confronted with follow code: char * test = "Hello"; cout << test << endl; //I expected see a hex address. cout << *test << endl; 2. How to assign non-address values to the pointer.
3 Answers
+ 2
thanks body but:
why should we assign a char to pointer? I am faced many time with same codes.
is there a comprehensive explain?