Question: Please troubleshoot this code: #include #include #include // Function prototypes void fillPassword(size_t, char[]); void showResults(char); // should have void listed void showMenu(void); // Define a
Please troubleshoot this code:
#include
#include
#include
// Function prototypes
void fillPassword(size_t, char[]);
void showResults(char);
// should have void listed
void showMenu(void);
// Define a variable to hold a password
// and the copy
char password[15];
//char cpassword[15];
int main(void) {
// Welcome the User
vprintf_s("Welcome to the C Array Program! ");
// Variables
char cont = 'y'; // To continue with loop
int ch;
size_t n = 5;
char* buffer;
buffer = (char*)malloc(n * sizeof(char));
int cVar = 0; // process variable
if (!buffer) {
vprintf_s("Unable to allocate memory");
return;
}
// Display menu and Get Selection
while (cont != 'E' && cont != 'e') {
// Display the Menu
showMenu();
// Get the user selection
if (getline(&buffer, &n, stdin) == -1) {
wprintf_s("Error Unable to read characters");
}
else {
char *p = strchr(buffer, ' ');
if (p) {
*p = '\0';
}
else {
/* Newline not found; flush stdin to end of line */
while ((ch = getchar()) != ' ' && ch != EOF);
if (ch == EOF && !feof(stdin) && !ferror(stdin)) {
vsnprintf_s("Error: End-of-File found, no new line");
}
}
cont = buffer[0];
}
// Display the menu response
showResults(cont);
}
free(buffer);
// Call the Copy routine
fillPassword(sizeof(password), password);
// Display variable values
printf_s("password is %s ", password);
printf_s("cVar is %d ", cVar);
// Copy password
//memcpy_s(cpassword, password, sizeof (password));
// Pause before exiting
char confirm;
printf_s("Confirm your exit!");
confirm = getchar();
return 0;
}
// Make a String of '1's
void fillPassword(size_t n, char dest[]) {
// Should be n-1
for (size_t j = 0; j
dest[j] = '1';
}
// Add null terminator for string
dest[n] = '\0';
}
/* Display the Results*/
void showResults(char value) {
switch (value) {
case 'F':
case 'f':
printf_s("Welcome to the Football season! ");
break;
case 'S':
case 's':
printf_s("Welcome to the Soccer season! ");
break;
case 'B':
case 'b':
printf_s("Welcome to the Baseball season! ");
break;
case 'E':
case 'e':
printf_s("Exiting the Menu system! ");
break;
default:
printf_s("Please enter a valid selection ");
}
}
/* Display the Menu*/
void showMenu(void) {
wprintf_s("Enter a selection from the following menu. ");
wprintf_s("B. Baseball season. ");
wprintf_s("F. Football season. ");
wprintf_s("S. Soccer season. ");
wprintf_s("E. Exit the system. ");
}

Error LiSt Entire Solution Q) 6 Errors ?7Warnings (? 0 Messages |xr Build-IntelliSense Search Error List Code Description Project WORK WORK WORK WORK WORK WORK WORK WORK WORK WORK WORK WORK WORK File Main.c Main.c Main.c main.c main.c main.c main.c main.c main.c main. main.c main. main.c ab E0165 too few arguments in function call ab E0165 too few arguments in function call ab E0165 too few arguments in function call ) C2198 'vprintf s': too few arguments for call ?2198 'vprintf-s': too few arguments for call C4013 'getline' undefined; assuming extern returning int ? C4133 (x) C2198 'function': incompatible types-from 'char [32]. to 'const wchar-t "const 'vsnprintf_s': too few arguments for call C4133 C4133 C4133 C4133 C4133 function': incompatible types-from 'char [44]' to 'const wchart *const function': incompatible types-from 'char [21]' to 'const wchart *const function': incompatible types-from 'char [21]' to 'const wchart *const function': incompatible types-from 'char [19]' to 'const wchart *const function': incompatible types-from 'char [21]' to 'const wchart *const
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
