The required length calculated storage space (creative reports) for a variety of string

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/ALPS233/article/details/102736109

First, single-byte characters is calculated, the length of the storage space required for each character width is
the sizeof (char) =. 1;
the sizeof (wchar_t) = 2;

And examples of the required storage space for each character string length (byte units)
char A [] = "12345"; // single length. 6
char B [] = "1234 in"; // plurality length. 7
wchar_t C [ ] = L "12345"; // width 12 length

Screenshot results:
Here Insert Picture Description

Guess you like

Origin blog.csdn.net/ALPS233/article/details/102736109
Recommended