hi i have this function
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;
}
when i use it the output is like this
34.77
6114.05
410.70
but i want to write them this way
34.77
6114.05
410.70
idea how?
%lfspecifies to read adouble, but you’re trying to store the result in afloat, which is half the size. The specifier for a float is just%f— or use adouble; floats are fairly useless on modern general-purpose computers.