What is character constants in C?

Every programming language has constant values that we used at the time of programming. Today, we will understand character constants in C. How they work? and how we can use them in any programme.

Let’s understand.

Character constants in C

These are the fixed character values that we use in our program. Basically we store these constant values in any character type variable.

Keep in mind, always put a single quote (‘) before and after the constant value.

char x='m';
char p='n';

You can see above two character constant values ‘m’ and ‘n’ respectively used in x and p variables.

Practically we use this kind of values in a program where we need a fixed value and that will not change.

You can also read

Hope that you understand the concept of a character constants in C.

You can also visit my other blog based on blogging tips and tricks.

Leave a Comment

Show Buttons
Hide Buttons