BIYU 发表于 2019-11-17 12:31:22

scanf随笔%*d的发现(2)

本帖最后由 BIYU 于 2019-11-17 13:09 编辑

如果是在scanf输出printf打印时,printf中出现%*d那么对应此%d顺序的值会变为打印时空出的格数,再将下一个输出到此%d中
        scanf("%d%d%d",&a3,&b3,&c3);
        printf("a = %d,b =%*d , c= %d\n", a3, b3, c3);
        printf("a = %d,b =%33d", a3,44);结果如下
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAnAAAABDCAYAAAAcYjiJAAAQFklEQVR4nO2d67WzKhCGU4B0M71MJzQyldCHPbF/AIrcHI07icn741nrnGyiiH7hda6PaZr8r8FWvDC9fR6fBtYFAAAAuAePd08AAAAAAAAcAwIOAAAAAOBmQMABAAAAANwMCDgAAAAAgJtRCThD7EW4+wVD7MU5P89zwIm3ZE5PwJD14ubleE7Yk6mPpx13ag6GvHVu9zq04wAAAAAA/pPHNEVhIs67JJA6As6Q9c45b2OmojHk2To/z+dETTieeI7fDeKwPr923FlIeQ3acQAAAAAA/8ligTNEnog8S18Yscze2W2ZiWCVqj/XQNbVYo2lEknacWcwZL2b591jaccBAAAAAPw3lQu1JZYSLLOfZ/FcuC5Hom+EYfHO2Y0rNAilrUjSjjt8/ugSFWYvg2NpxwEAAAAAvIJDAs6Q9WLr2LOWZe4swbJWi8Sz40aQdd4Je2PGwkw7DgAAAADgFRwScC2uFDVE1osiSUA7bjhvsotVb3QN2nEAAAAAAK/iaQHH4p62vuXxZaNWTtpx2nknITYSZtpxAAAAAACv4ikBZ1i8XOQ6naaQXWrd7Oci3u3suNG8c9HZE2bacQAAAAAAr+S0gLtavC3HNexlnr3wXk023bjm98qM1oYw044DAAAAAHg1pwTcf4m3hDar9Uz2a0h+mIcIG/W4d99AAAAAAPwehwWcIdvs1EB0pg6cNDsqlMJMO+4sWssaLHAAAAAA+AQOlxEp67FNU9vduEcqAFzGsSXXaIo90457Bgg4AAAAANyJjYALLbVCf1MuA/qXPqChY0PO2UxUsm5zLmNiJwi3re+m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t4isObZ1fVv/sEwXX18W7XSusqej3gAAAA3IsyxrkUcIbYWyteJLo+e0kMMQC/fOk3yZMj7Rf4XsmpdNzDdeBSEP7mGmy0MG2zW+c5WJ62xKTERnZpPXe7ljuRbUZosqRJXJdNsf+idmzKQK28YxS9fMPCw7UIzjN5q/udtc9qxchZt+9h+wZ+UsCxFXRTAACALyW0VmqItNg4fS90xi1JEdZba5dkgRG93qqLazOKkU8UFSbFyv3D3ErX7jPHYStLduvuOe33x6n/pIADAAAAALgzEHAAAAAAADcDAg4AAAAA4GZAwAEAAAAA3AwIOAAAAACAmwEBBwAAAABwM/4AbCFww3XLPGUAAAAASUVORK5CYII=

将本该输出给b3的值变成了b3的宽度之后将后续的本该属于c3的值输入到b3中
页: [1]
查看完整版本: scanf随笔%*d的发现(2)