我使用了一个非常简单的代码:
int main(void)
{
size_t variable;
/*prompt*/
printf("enter the value of the variable: ");
scanf("%zd", variable);
printf("you entered %zd value of the variable", variable);
}
Run Code Online (Sandbox Code Playgroud)
但是,GCC编译器会产生以下结果:
Enter the vale of the size_t variable: 15
You entered zd value of size_t type
Process returned 35 (0X23) execution time: 3.094s
Press any key to continue
Run Code Online (Sandbox Code Playgroud)
我的书也直接演示了上面的例子,但没有提到它是某种特殊的格式说明符,如果要包含库文件的话.即使是在线编译器也没有产生正确的结果.为什么代码不起作用?