Home  >  Article  >  Backend Development  >  What does char mean in c language?

What does char mean in c language?

藏色散人
藏色散人Original
2020-02-20 10:26:5577006browse

What does char mean in c language?

What does char in c language mean?

Char is a basic data type that accommodates single characters. It cannot store Chinese characters. (A Chinese character occupies 2 bytes.) String is used to store strings. In fact, String is an array of char, but among it The element has one more '\0' at the end of the array, indicating the end. For example, the string abcdchar a[]={'a','b','c','d','\0'}; is equivalent . And a variable can only store one character; if you want to store multiple characters, use the string type.

Recommended: "c Language Tutorial"

What does char mean in c language?

Extended information:

char is a C/C integer type A weird one among the data. Others, such as int/long/short, etc., default to signed when signed/unsigned is not specified. However, char is unsigned in the standard. The compiler can implement it as signed or unsigned. Symbolic, some compilers, such as the pSOS compiler, can also specify whether it is a signed number or an unsigned number through a compilation switch.

In MYSQL, the field type char refers to: a string represented by a fixed length of a specified length; such as char (8), the database will use a fixed 1 byte (eight bits) to store data , strings with less than 8 characters are followed by null characters.

For more programming related content, please pay attention to the Programming Introduction column on the php Chinese website!

The above is the detailed content of What does char mean in c language?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn