Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function bracket_ by_len that takes a word as an input argument and retu

ID: 3556477 • Letter: W

Question

Write a function bracket_ by_len that takes a word as an input argument and returns the word bracketed to indicate its length. Words less than five characters long are bracketed with << >> , words five to ten letters long are bracketed with (* *) , and words over ten characters long are bracketed with /+ +/ . Your function should require the calling function to provide as the first argument, space for the result, and as the third argument, the amount of space available. Consider the expected results of these calls to the function.

For example:                                     

bracket_ by_len(tmp, "insufficiently", 20)

Explanation / Answer

bracket_ by_len(tmp, char *string, int space)

{

int len=strlen(string);

if(len>=5)

printf("the length of string is << %d >> ");

else if(len>5 && len <10)

printf("the length of string is (* %d *) ");

else if(len>10)

printf("the length of string is /+ %d +/");

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote