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

Let\'s say you want to do something like char selection = \' \'; if(selection==\

ID: 3657909 • Letter: L

Question

Let's say you want to do something like char selection = ' '; if(selection=='p' || selection=='P') { printf("you selected the letter P) } what kind of user definition function would you make? and how would you call it in the main? such as char GetLetter( char let); (Prototype) then for defined function char GetLetter (char let) { printf("Pick one of the options ABOVE "); scanf("%c", &let;); return let; } then to call it selection = GetLetter(); OR GetLetter(selection); ?? Is that right? My program says it isn't...

Explanation / Answer

char GetLetter(){ char selection; printf("Pick one of the options ABOVE "); scanf('%c',selection); return selection; } void selected(char s){ if(s == 'P' || s == 'p'){ printf('P is selected'); } //repeat the same for the set of options } int main(){ char s; s = GetLetter(); selected(); } // Please rate the answer