C output question

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

Why its output is %%??

#include
int main(void)
{
        printf(\"% % %\\n\");
return 0;
}
2条回答
  •  情书的邮戳
    2021-01-29 08:13

    If you use one %, it sees it as string (because it lacks other specifiers) and output %. If you use %%, it is to print % in output. if you use %%% the first two will be considered as outputting % and the last one as single "character". so you only get two %.

提交回复
热议问题