Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 1 个数组中有 2 个向量,例如:A: 1,2,3 -B: 4,5,6 数组看起来像:1 2 3 4 5 6,我必须将它的二元乘积打印到 .txt 文件中,但我printf() 有问题
FILE *f; f=fopen("log.txt","w+"); for(i=0;i<n;i++) for(j=n;j<e;j++) { k++; fprintf(f,"%d \t",(t[i]*t[j])); } fclose(f);
我猜在你的代码的某个地方你有一个看起来像这样的 fprintf
fprintf("format", args);
你忘记了 file 参数:
fprintf(f, "format", args); ^^