The following code
#include <iostream>
#include <string>
int main()
{
std::string s = "abc";
for (char c : s)
std::cout << (int) c << " ";
}
prints "97 98 99 ".
The following code
#include <iostream>
int main()
{
for (char c : "abc")
std::cout << (int) c << " ";
}
prints "97 98 99 0 ".
Where is the extra 0 coming from in the second code?