C primer plus第80页4.16
程序代码:
#include<stdio.h> int main() { unsigned width,precision; int number=256; double weight=242.5; printf("What field width?\n"); scanf("%d",&width); printf("The number is:%*d:\n",width,number); printf("Niw enter a width and aprecision:\n"); scanf("%d%d",&width,precision,weight); printf("Weight=%*.*f\n",width,precision,weight);/*这行*/ return 0; }
可以运行,但运行到倒数第二行的时候就会出现程序出现错误。我是按书上写的。