Inverted arguments in scanf()

前端 未结 3 1857
既然无缘
既然无缘 2021-02-19 14:28

I was (quickly) writing some code and accidently inverted the arguments in scanf():

char i[] = \"ABC1\\t\";
scanf(i, \"%s\");

Comp

3条回答
  •  猫巷女王i
    2021-02-19 14:39

    I suppose it shouldn't.

    int scanf ( const char * format, ... );
    

    i was normally converted to a const char*, all the rest parameters are just "ellipsis" and cannot be checked at compile time.

提交回复
热议问题