Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

An example Analysis of inputting Chinese string in C language

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

In this article Xiaobian for you to introduce in detail "C language input Chinese string example analysis", the content is detailed, the steps are clear, the details are handled properly, I hope this "C language input Chinese string example analysis" article can help you solve doubts, the following follow the editor's ideas slowly in-depth, together to learn new knowledge.

Strings in C language are stored in the form of ASCII code table, and input English characters are entered into the register in the form of ASCII codes corresponding to English characters, such as outputting hello worldcodes:

Disassemble c to get

You can see that the ASCII code of h is 68 and the ASCII code of e is 65 and so on. What about the Chinese characters? There is no corresponding ASCII code for Chinese characters, can it still be displayed?

The answer is yes, of course, the coding rule used to store Chinese in the computer is GB2312 or GB2312-80, which stipulates that a character less than 127has the same meaning as the original, but when two characters greater than 127are linked together, it represents a Chinese character, so that we can combine about 7000 simplified Chinese characters. In these codes, even the numbers, punctuation and letters that already exist in ASCII are re-coded with two bytes long, which is often called "full-width" characters, while those under 127th are called "half-width" characters.

Disassemble the code

This is the storage method in Chinese.

But in this way, there are drawbacks. The meaning of the symbols in our country's GB2312 may be different from those in other countries, that is, the two countries use the same number to represent different symbols, so Unicode appears, and I will not explain the coding method of Unicode.

After reading this, the article "case Analysis of input Chinese string in C language" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it before you can understand it. If you want to know more about related articles, welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report