gpt4 book ai didi

C, 变量 f1 周围的堆栈被破坏

转载 作者:太空宇宙 更新时间:2023-11-04 02:11:29 24 4
gpt4 key购买 nike

你好我有这个功能

int printofarray(int *j,double *n)
{
int x,k;
k=*j;
if(n==NULL) {
printf("array was not created\n");
return 1;}

for(x=0;x<k;x++){
printf("%.2lf\n",*(n+x));}

return 0;
}

当我使用它时输出是这样的

34.77
6114.05
410.70

但我想这样写

  34.77
6114.05
410.70

想法如何?

最佳答案

副手,尝试 %f 而不是 %lf 的 f1。编辑:%lf 是双倍的。

关于C, 变量 f1 周围的堆栈被破坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13426516/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com