C6064: missing integer argument to <function> corresponding to conversion specifier <number>

#include <stdio.h>
int main(){
char s[10];
scanf_s("%s", s);
for (int i = 0; i < 10; i++)
    printf("%s\n", s);

This error appears in visual studio

Exception thrown at 0x7B8BEF1C (ucrtbased.dll) in 1.exe: 0xC0000005: Access violation writing location 0x00942000.enter image description here

asked on Stack Overflow May 23, 2021 by Islam.Abdelbakey • edited May 24, 2021 by Islam.Abdelbakey

1 Answer


You're missing arguments. The proper usage is

scanf_s("%s", s, 10);


scanf_s("%9s", s, 10);

(These are slightly different.)

You should also check the value returned before using s.


answered on Stack Overflow May 23, 2021 by ikegami

User contributions licensed under CC BY-SA 3.0