求教问题 - 比较scanf输入
程序代码:
/* Indicate if scanf format strings are equivalent, if not, show difference. */ #include <stdio.h> int main(void) { /* "%d-%d-%d" versus "%d -%d -%d" */ char x2, y2; printf("Input first series number here:"); scanf("%d-%d-%d", &x2); printf("Input second series number here:"); scanf("%d -%d -%d", &y2); printf("%c\n%c\n", x2, y2); return 0; }
运行程序,输入1-1-1
程序停止工作
问题:
是声明有问题?还是printf % 有问题?