-2

I want to solve this problem without "#pragma warning (disable:4996)" please help me. I tried many things. I think it may have problem with visual studio.

  • Define that symbol before including any headers. – Shawn Apr 28 '19 at 14:07
  • 1
    Possible duplicate of [error C4996: 'scanf': This function or variable may be unsafe in c programming](https://stackoverflow.com/questions/30577519/error-c4996-scanf-this-function-or-variable-may-be-unsafe-in-c-programming) – Joe Amenta Apr 28 '19 at 15:33
  • 1
    If reopened, this should be closed as a duplicate of @JoeAmenta's suggested duplicate. – Jonathan Leffler Feb 07 '22 at 23:08

1 Answers1

1

Use scanf_s() and make the necessary other changes, or #define _CRT_SECURE_NO_WARNINGS. Basically, read the error message and do what it suggests.

Note that scanf_s() requires extra arguments for the lengths of “string” arguments.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278