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

A lazy programmer has recently left the company you work for, and you have inher

ID: 3771260 • Letter: A

Question

A lazy programmer has recently left the company you work for, and you have inherited all his programs. However, the program shown below contains no documentation and the users don't know what to do with it. Please review the program and, without compiling or running it, copy and paste it into the answer box, and add comments that describe its functionality in as much detail as possible. Use the proper syntax for commenting in C so that the program will continue to compile.

A lazy programmer has recently left the company you work for, and you have inherited all his programs. However, the program shown below contains no documentation and the users don't know what to do with it. Please review the program and, without compiling or running it, copy and paste it into the answer box, and add comments that describe its functionality in as much detail as possible. Use the proper syntax for commenting in C so that the program will continue to compile.

  #include <stdio.h>    void PrintFace(char eym) {     char n = '>';       printf("  %c   %c ", eym, eym);     printf("    %c ", n);            printf("  %c%c%c%c%c ", eym, eym, eym, eym, eym);        return;  }    int main() {     char usrKey = '-';         printf("Enter key: ");     scanf("%c", &usrKey);     PrintFace(usrKey);       return 0;  }  

Explanation / Answer

#include //include the header file void PrintFace(char eym) //function declared which accepts a char variable (passed by value) and doesn't return any value to the caller function. { char n = '>'; //function variable that stores a char value printf(" %c %c ", eym, eym); // to print the value of char variable eym twice printf(" %c ", n); // to print the value of char variable n once printf(" %c%c%c%c%c ", eym, eym, eym, eym, eym); // to print the value of char variable eym 5 times return; // returns void to the caller function indicating normal execution } int main() //main function to execute all the functions { char usrKey = '-'; // function variable that stores char value.initialised with '-' printf("Enter key: "); // to print the message on the console scanf("%c", &usrKey); //to take the input from user and store it in the variale userkey. PrintFace(usrKey); //calling the function PrintFace and passing it the value of userkey variable entered by the user. return 0; //return statement to return 0 if execution is normal }
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