Skip to content
Snippets Groups Projects
Commit 5d73051a authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

printing chars and unsigned chars correctly

parent e7b0a65a
No related branches found
No related tags found
2 merge requests!20new tag,!19new tag
...@@ -25,7 +25,10 @@ void printArray(std::string name, T (&array)[size]) ...@@ -25,7 +25,10 @@ void printArray(std::string name, T (&array)[size])
std::cout << name << ": ["; std::cout << name << ": [";
for (int ii = 0; ii < size; ++ii) for (int ii = 0; ii < size; ++ii)
{ {
std::cout << array[ii]; if (std::is_same<T, char>::value or std::is_same<T, unsigned char>::value)
std::cout << (int)array[ii];
else
std::cout << array[ii];
if (ii == size - 1) if (ii == size - 1)
std::cout << "] \n"; std::cout << "] \n";
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment