Among the major programming languages C C++, J**A, and Python, only C C++ and J**A have both char and int types. Therefore, the following narrative is based on the case of C C++ and J**A.
Without the help of any function that has the function of measuring the width of the data, the data width of the char type in C C++ is more than 1 byte based on the intuitive representation of the compiler of the programming language, and the data width of the char type in J**A is greater than 1 byte. The above judgment is mainly tested by assigning Chinese characters and English characters to char type variables, after practical operation, c c++ and j**a both support the use of English characters to assign values to char type variables, and in terms of Chinese characters, c c++ is not supported and j**a supports, this difference plus the contact Chinese character is a double-byte character data, it is not difficult to make a judgment.
To further determine the width of char-type data in C++ and J**a, you can use a function that specifically measures the width of the data.
Can be used in C C++sizeofTo judge, sizeof is a memory capacity measurement function, the function is to return a variable or type of byte size, the usage is also relatively simple, can be called in the form of a function or an expression, as follows:
This can be determined based on the return result of sizeof 1In C C++, the width of the char type is 1 byte
Although there is no function in J**A that specifically measures the memory size of data, due to cross-platform support, the size of the basic data type in J**A is fixed in different systems. According to official information,The char type in j**a is 2 bytes in size, which can be supported by the previous operation that supports assigning Chinese characters to char type variables.
For determining the width of the data of the int type, for C C++, use Sizeof directly, and for J**A, refer to the official documentation.
Judging by the running results,The data width of type int in C C++ is 4 bytes
According to the data about the width of the data of type int in j**aThe data width of the int type in j**a is 32 bits, or 4 bytes, because one byte is 8 bits.