Hello. Seeing as strlen's return type is size_t, and not int, should I have the loop's iterator be of type size_t as well? If I don't, I get the following warning message: "warning C4018: '<' : signed/unsigned mismatch".
TL;DR:
1 2 3 4 5 6 7 8 9
char our_string[15] = "Hi there!";
for (int i = 0; i < strlen(our_string); i++)
our_string[i] = 'X';
// Vs.
for (size_t i = 0; i < strlen(our_string); i++)
our_string[i] = 'X';
I know it doesn't really matter, but these kind of things bug me.
@DTSCode std::size_t is an unsigned integral type large enough to represent an array index and is used by most STL containers and most other things in the standard library. When in doubt, use std::size_t, but prefer a container's specific size_type.