How to represent a blank space in the C language?

In C language, there are two ways to represent a character space.

Use single quotes `’ ‘` to represent a space character:

char space = ' ';

In the above code, a variable named ‘space’ of type ‘char’ is created and assigned the value of a space character.

2. Representing the space character using ASCII code values:

char space = 32;

In ASCII encoding, the decimal ASCII value of a space character is 32. Therefore, we can directly use this value to assign it to the character variable `space`.

Whether using single quotes or ASCII code values, you will ultimately get a variable that represents a space character. This variable can be compared, concatenated, or printed with other characters as needed.

bannerAds