Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What is the difference between character type and string type in C language?
What is the difference between character type and string type in C language?
I only answer your question. You can contact me if you don't understand anything else.

char c; Declare the character variable c, and the system allocates a space of one character for C.

C = "abcd// This is not right. Abcd takes up four characters, so it can't fit in C.

You can also use "char" to declare string constants. You need to use arrays. If you haven't studied arrays, you will understand. ) for example:

Char string [4];

string = " abcd

Stored in the string is the string "abcd".

When printing character types, printf("%c/n, "c 1); if printing character types, just change %c to% s, for example:

Printf("%s ",string); //print string (abcd)