Argument not passed sufficiently for format string C4473 'scanf_s'.

Asked 1 weeks ago, Updated 1 weeks ago, 1 views

int main(void) 
    char apb;
    printf ("What is your favorite alphabet?"");
    scanf_s("%c", &apb);
    printf("My favorite alphabet %c", apb);
    return 0;

Debugging, you get the right results With the error statement below,

The argument for the
C4473 'scanf_s' format string was not passed sufficiently.
Placeholders and their parameters require two variable arguments, but one has been provided.`
Missing variable argument 2 is required for format string '%c'

That's what it says. I followed the instructor while watching C language YouTube, but what's the problem?


2022-09-20 08:58

1 Answers

scanf_s("%c", &apb);

Change the code above as below. The place where &apb refers to is 1 byte of space, so you have to put 1 at the end.

scanf_s("%c", &apb, 1);

2022-09-20 08:58

If you have any answers or tips

© 2022 pinfo. All rights reserved.