convert_to_ascii

convert_to_ascii
Turn-in directory02_convert_to_ascii/
Files to turn inconvert_to_ascii.c
Allowed functionsNone
Type of workFunction
  • Write a program which displays Hello Codam! on standard output, followed by a newline.
  • To help you get started, we will provide some code for you to copy/paste/edit. Make sure you understand every line before you hand it in!
  • You need to write a function that takes an integer as a parameter and returns the character that represent it if the integer is between 0 and 9. Otherwise, the function returns '\0'.
  • You need to fix the prototype of the function in the provided code to have the proper return type and parameter type before implementing the function.
#include <stdio.h>

return_type convert_to_ascii(parameter_type parameter_name);

int main()
{
    int five = 5;

    char c = convert_to_ascii(five);
    putchar(c);
    if (c == '5')
        printf("The function seems to work!");
    else
        printf("The function doesn't work!");
    return 0;
}

Example output:

$ ./a.out
"The function seems to work!$