+ 2

Why does the following snippet of code output only one symbol?

cout << *("Hello!"); // H

2nd Mar 2019, 9:39 PM
coding-space.ru
coding-space.ru - avatar
1 Antwort
+ 2
Every string is an array of char. "Hello!" is in fact an Adress to an array of char. So, doing *("Hello!") takes the first value of that array and outputs it.
2nd Mar 2019, 10:21 PM
Théophile
Théophile - avatar