Introduction to characters in C
Character constant is a single characters enclosed within the pair of single quotes (‘). It can contain any alphabet, digit, special character as well as space. We can’t store more than one character in it.
‘A’ , ‘5’ , ‘$’ etc.
Character variable is a variable of char data type.
Example : char gender;
Character Variable Initialization:
Character variable can be initialized just like variables of other data types.
Example: char gender=’F’;
|Program for reading and displaying character variable.|
printf(“\nEnter a character=”);
|Enter a character=k
Popular Books of Computer Science