EDIT: This is the error I am getting. I am getting this error after the program works perfectly, and I don't know why. I am trying to add in strings into a temp variable which then adds them to a struct array, the name temp value space is 15 and then checks if the name is over 15 characters and asks the user to re enter the string if true. It may be because of the buffer in entering to name var but I don't know.
typedef struct {
char name[15];
int score;
int riskF;
} player_info;
int main()
{
player_info players[20];
char name[15];
int gameN = 0;
int riskF = 0;
int accScore = 0;
int totalplayers = 0;
int count = 1;
int length = 0;
int maxName = 15;
printf_s("Enter player %d: ", count);
scanf_s("%s", name, 999);
length = strlen(name);
if (length < maxName)
{
strcpy_s(players[totalplayers].name, name);
totalplayers++;
count++;
}
else
{
printf_s("\nName too big; please enter a name within 15 characters!\n\n");
}
length = 0;
printf_s("done!");
return 0;
}