pointers chara

hay guys, i have this doult with pointer to charas, see

chara* somepointer="hello";

in the tutorials it states that the value of somepointer should ezual to the address of 'h' and somepointer[1] 'e' but if i ask

cout <<somepointer;

it prints hello

shouldnt it print the address? im getting really confused, could somone explain why it prints hello and not the address of 'h'
char* usually means a string, so operator << is overloaded for char* so that it prints that string. If you want to print the pointer you could do cout << (void*)somepointer;
A pointer can be seen as a memory address that reads the value to which you point (with the length of the sizeof() operator). This means that a pointer is an array as much as it is a pointer. A char* could therefor be a char-array, this means that it's a sequence of chars that are indexed with unsigned values.
somepointer[0] = 'h'
somepointer[1] = 'e'
somepointer[2] = 'l'
etc.
thx guys,

and kyon i know that lol. so correct me if im wrong, chara* is considered string. but then

somepointer should equal to somepointer +0 but dosnt that equal to the value of somepoiter? and shouldnt that be the address
but then somepointer should equal to somepointer +0 but dosnt that equal to the value of somepoiter?
somepointer is a pointer. a pointer is basically an integer that represents the address of something in memory (a c string in this case). Of course somepointer == somepointer + 0 == &somepointer[0].
Topic archived. No new replies allowed.