Catching c++ "Access Violation Writing Exception”?

  • Thread starter Thread starter Mukesh Lekhrajani
  • Start date Start date
M

Mukesh Lekhrajani

Guest
Hello,

This is my program, and when i run it, the 1st SCANF_S is running properly, but the next SCANF_S (bold in the code) with the string input is not running.. it produces an error "Access Violation Writing Exception"....

#include <stdio.h>

#include <string.h>
#include <math.h>
#include <stdlib.h>

int main()
{
char ch;
char s[100];

scanf_s("%c", &ch);
scanf_s("%s", s);

printf("%c", ch);
printf("%s", s);

return 0;
}

could you please help..


Thanks,

Mukesh Lekhrajani

Continue reading...
 
Back
Top