Welcome Guest.

1Answers

C language SCANF input character When using% 3C will be stack overflow

Asked by: Johnny Lee 196 views IT August 10, 2021

addition: will report this error

1 Answers

  1. +1Votes  

    CHAR can only be one byte character, and your scanf% 3c specifies the width of 3 bytes, which cannot be entered

    but the compiler will notTo judge this situation (no one will use this), it may cause memory overflow (different compiler processing), may also function properly (GCC will not report error), but the result is definitely not you wantThe format of the

    scanf must meet the requirements of the variable, otherwise the result is “unpredictable”

    Kathryn Lloyd- August 10, 2021 |