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

I\'m having issues with the error check if else statement When I enter ^z for fi

ID: 3764205 • Letter: I

Question

I'm having issues with the error check if else statement

When I enter ^z for file name, it is suppose to enter the if stat and print the the error message, but it skips the if else statement entirely and continues on to my next function. I think that my parameter for the if statement is wrong, I'm not really sure though. Also, in main this is how i defined rc: int rc;

void getFile(char file_name[], int* rc)
{
printf(" Project 4: ");
printf(" Enter File Name: ");
*rc = scanf("%s", file_name);
if(*rc == 0)
{
printf(" Error: No file name entered.");
exit(100);
}

return;
}

Explanation / Answer

your are strating with ponter = Null

{

then you can start your else part.

*rc=scanf("%s",filename) is  incompatible implicit declaration of built-in function 'scanf'.

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