C output question

后端 未结 2 649
旧巷少年郎
旧巷少年郎 2021-01-29 07:23

Why its output is %%??

#include
int main(void)
{
        printf(\"% % %\\n\");
return 0;
}
2条回答
  •  不要未来只要你来
    2021-01-29 07:57

    It's undefined behaviour and absolutely anything can happen. Section 7.19.6.1/9 of C99 states:

    If a conversion specification is invalid, the behavior is undefined.

    and none of the preceding sections allow a conversion specifier of a space. They are limited to characters from the set diouxXfFeEgGaAcsPn%.

提交回复
热议问题