Why length(str) != sizeof(str)?

What exactly do you want to know?

The number of bytes making up the string? sizeof(str)
The number of characters in the string? length(str)

Which is the “true” length? I don’t know, depends on what you are doing with it…you probably want bytes if you are saving it, you probably want length if you are displaying it…

2 Likes