我试图让以下内容显示
static const char MSG[] = "Test %ld\n";
static int COUNT = 5;
fprintf(stdout, "%s", MSG, COUNT);
但此时,输出显示
Test %ld
如何格式化%ld
以显示5?
答案 0 :(得分:1)
试试这个:
#include <stdio.h>
int main ( void )
{
static const char MSG[] = "Test %ld\n";
static int COUNT = 5;
fprintf(stdout, MSG, COUNT);
return ( 0 );
}