I faced with some problems about pointers. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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.

17th Apr 2019, 2:58 PM
Alireza Abbasi
Alireza Abbasi - avatar
1 Answer
+ 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?
17th Apr 2019, 4:17 PM
Alireza Abbasi
Alireza Abbasi - avatar