1. Representation of ASCII in C
In C programming language characters are not actually stored as characters in the memory, but rather as numeric ASCII representations of these characters. Because of this, each character can be printed as a character and as its numeric equivalent. Just like in the example below:
Example 1: C code to print numeric and char values.
#include
<stdio.h>
int
main
(
void
)
{
char
c
=
'B'
;
printf
(
"1. Numeric: %d \n, 2. Char: %c"
, c, c);
return
(0);
}
Output:
2. Char: B
The standard ASCII table is often grouped into two subgroups, i.e., printable and control characters. The total number of printable characters is 95 (from 32 to 126). Whereas control characters amount to a total of 32 characters (from 0 to 31). In the C programming language printable characters, in turn, can be found with the isprint function. Control characters can be found with the help of iscntrl function.