Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
1st Parameter
The character to be converted to its ASCII equivalent. This is passed as an `int` to allow handling of `EOF` or extended character values.
Read more about parameters of toascii in parameters section
The toasciifunction in C language Converts a character to its ASCII equivalent.
The toascii function converts the given integer to a 7-bit unsigned char value that fits into the ASCII character set, by clearing all but the least significant 7 bits. This function is often used when ensuring that a character is within the ASCII range.
The toasciifunction takes 1
parameter:
•
int `c`: The character to be converted to its ASCII equivalent. This is passed as an `int` to allow handling of `EOF` or extended character values.
Converts the given character `c` to its ASCII equivalent by zeroing out all but the lowest 7 bits of its value. Returns the resulting ASCII value as an `int`. If `c` is already an ASCII character, its value remains unchanged.
The toascii function return value :
The value returned is that of the converted letter, or the value of c if it's already an ASCII character
Output
This example converts a non-ASCII character to its ASCII equivalent.