Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C language, how to assign values ??to 3 char variables? You cannot directly use char a='D', this kind of thing.

It is required to use printf and scanf.

C language, how to assign values ??to 3 char variables? You cannot directly use char a='D', this kind of thing.

It is required to use printf and scanf.

char

a,b,c;

/*First define three character variables*/

scanf("% c,%,c%,c",&a,&b,&c);

/*Use the input function scanf(), %c is the character type*/

/* End of program*/

Note:

1. The function printf() is used for output, while the function scanf() is used for input;

2. Use When entering the function scanf(), pay attention to the type of input data:

For integer types, apply %d;

For floating point types (float), apply %f;

p>

Apply %c for character type (char);

Apply %s for string type;