我試圖在Turbo C中運行此程序,但無法破譯輸出。這個%*c
是什麼意思?任何幫助,將不勝感激。%* c in scanf() - 這是什麼意思?
int dd,mm,yy;
printf("\n\tEnter day,month and year");
scanf("%d %*c %d %*c %d",&dd,&mm,&yy); // what does %*c mean ?
printf("\n\tThe date is : %d %d %d",dd,mm,yy);
輸出
Enter day, month and year 23
2
1991
3
5
The date is: 23 1991 5
捨棄下一個字符。 – nhahtdh 2012-07-18 13:01:43
如果他想放棄接下來的3個字符,該怎麼辦? – 2012-07-18 13:02:34
@tuğrulbüyükışık:你可以使用'%* 3c'來指定要跳過的字符數。 – 2012-07-18 13:19:01