In C Programming, please complete the function get_letters() also please show how to test the input given: Complete the

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

In C Programming, please complete the function get_letters() also please show how to test the input given: Complete the

Post by answerhappygod »

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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply