The difference between gets() and gets_s() is that gets() writes characters out to an array that you provide and trusts that you have enough room, while gets_s() does a check for length before writing. For the following:
char* array1 = new char[20];
gets_s(array1);
char array2[20];
gets_s(array2);
The compiler can determine (at compile time) that array2 is of size 20, but can not do the same for array1. Whenever you pass a pointer to gets_s(), you also need to pass its length for the code to compile.
See the Microsoft documentation
here[
^].