Home>Article>Backend Development> 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"
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 theProgramming Introductioncolumn 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!