Q6: Define character and classify characters in C with one example of each.

 

A6: A character (char) is a basic data type that represents a single character from the character set, which includes letters, digits, symbols, and control characters.

 

Characters are classified into four categories:

 

Alphabetic Characters: It includes uppercase and lowercase alphabets.

e.g. char cLetter = 'A'; char sLetter = 'b';

 

Numeric Characters: These characters represent digits from 0 to 9.

e.g. char digit = '7';

 

Special Characters: It includes various symbols, punctuation marks, and whitespace characters.

e.g. char dollar = '$';

 

Escape Sequences: They are combination of backslash ‘\’ and a lowercase alphabet to represent non-printable char.

e.g. char tab1 = '\t';

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.