In C Programming, please complete the function get_letters() also please show how to test the input given: Complete the
Posted: Tue May 24, 2022 8:15 am
In C Programming, please complete the
function get_letters() also please show how
to test the input given:
Complete the provided program by defining
the get_letters() function. From the
function declaration, you can see that this function takes 2
parameters:
Use a loop to obtain all of the characters entered through
standard input and store them in the character array pointed to
by letters. Hint: You will need to
handle the new line character that follows every letter entered
through standard input. This can easily be done with a small tweak
to the format string used with the scanf() function.
You can assume that only a single alphabetical letter will be
entered each time you read information from standard input and you
will never read more than 9 letters in total. Some examples of the
program being run are shown below.
For example:
#include <stdio.h>
#include <string.h>
void get_letters(char* letters, int number);
int main(){
char letters[10];
int number;
memset(letters, '\0', 10);
scanf("%d", &number);
get_letters(letters, number);
printf("%s\n", letters);
return 0;
}
//define the get_letters() function here
function get_letters() also please show how
to test the input given:
Complete the provided program by defining
the get_letters() function. From the
function declaration, you can see that this function takes 2
parameters:
Use a loop to obtain all of the characters entered through
standard input and store them in the character array pointed to
by letters. Hint: You will need to
handle the new line character that follows every letter entered
through standard input. This can easily be done with a small tweak
to the format string used with the scanf() function.
You can assume that only a single alphabetical letter will be
entered each time you read information from standard input and you
will never read more than 9 letters in total. Some examples of the
program being run are shown below.
For example:
#include <stdio.h>
#include <string.h>
void get_letters(char* letters, int number);
int main(){
char letters[10];
int number;
memset(letters, '\0', 10);
scanf("%d", &number);
get_letters(letters, number);
printf("%s\n", letters);
return 0;
}
//define the get_letters() function here