char str[] = "helloworld"; // 10 characters + '\0'
char *s = str;
std::cout << (long int)s << std::endl;
std::cout << std::hex << (long int)s << std::endl;
// std::cout << std::dec;
// I found out that, using the above code reverts default formatting to decimal back.
std::cout << (long int)s << std::endl;
The output is:
140728139979229
7ffdd2cb19dd
7ffdd2cb19dd
Using std::hex
once, does affect the formatting of other lines also, so I assume it is changing a setting. Now, my question is, how can I use it to affect only once, only the line it is used in?
If this is the only way it is used, then what can I use instead?