I am currently working on a project, and am having trouble understanding part of the code
A section of this code is:
Code:
complex input_complex(FILE *infile)
{
complex z = {0,0};
double re = 0, im = 0;
char op, ch;
fscanf(infile,"%lf %c%lf%c",&re,&op,&im,&ch);
if (infile != stdin && !good(im,op,ch)) {
printf("Improperly formed complex number in input file; goodbye\n");
exit(1);
}
while(!good(im,op,ch)) {
printf("Illegal input for complex number; try again\n");
fscanf(infile,"%lf %c%lf%c",&re,&op,&im,&ch);
}
z.re = re;
if (op == '+')
z.im = im;
else
z.im = -im;
return z;
}
int equal_complex(complex z, complex w)
{
return z.re == w.re && z.im == w.im;
}
double mag_squared(complex z)
{
return z.re*z.re + z.im*z.im;
}
complex scalar_multiple(double c, complex z)
{
complex w = ZERO;
w.re = c*z.re;
w.im = c*z.im;;
return w;
}
complex conjugate(complex z)
{
complex w = ZERO;
w.re = z.re;
w.im = -z.im;
return w;
}
/*****************************************************************/
/* FUNCTIONS FOR YOU TO IMPLEMENT - JUST STUBS FOR NOW */
/*****************************************************************/
void output_complex(FILE *outf,complex z)
{
z.re = 2;
fprintf(outf,"2+2i");
}
The top section is what was given and is to not be changed, and the function output_complex is what i have to edit
and looking at the code that is in output_complex, i am confused with what fprintf(outf,"2+2i"); means, and most importantly what outf specifically means