Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to assign value to char in c language
How to assign value to char in c language
1, char type, also known as character type. Char types, like other types, can be declared (defined) before assignment (initialization) in definition and initialization. Use char to define a character and enclose it in single quotation marks.

2. Of course, you can also initialize variables when defining them (that is, assign values when declaring variables).

3. Note that characters are not letters, but single characters enclosed in single quotation marks. The so-called words can be numbers, Chinese and the like.

4. Character types can be automatically converted into int types with larger storage space. For example, in the following example, c is a character, and when it is assigned to i 1 of type int, it will not be reported as an error due to automatic conversion.

5. When int is converted into word type (which belongs to the conversion of storage space from large to small), strong conversion is needed.

6. After adding cast, no error will be reported.