#include<stdio.h>
void main()
{
int a,b,p;
printf("Enter values of a and b");
scanf("%d%d", &a, &b);
p=printf("a=%d b=%d p=%d",a,b, p);
}
这是我的问题的代码。将输入视为a = 2和b = 3.
答案 0 :(得分:3)
变化:
p=printf("a=% b=%d p=%d",a,b, p);
为:
p = printf("a=%d b=%d\n", a, b); // <<< fix format string
printf("p=%d\n", p); // <<< print `p` *after* you have assigned a value to it
请从今天开始启用编译器警告 - 任何优秀的编译器都会在编译时向您指出所有上述错误。