September 2019 1 224 Report

Codul acesta îmi afișeaza "2, 3" ci nu "2, -3" cum as vrea eu.


De ce functia conjugaComplex nu imi schimba valoarea celor doua numere in afara functiei?


#include < stdio.h >
#include < stdlib.h >

struct nrComplex
{
float Re, Im;
};


void conjugaComplex (struct nrComplex x)
{
x.Re = x.Re;
x.Im = (-1)*x.Im;
}

int main()
{
struct nrComplex z1 = {2,3};

conjugaComplex(z1);

printf("%f, %f", z1.Re, z1.Im);

return 0;
}

void conjugaComplex (struct nrComplex n);

Smile Life

Show life that you have a thousand reasons to smile

Get in touch

© Copyright 2024 DOKU.TIPS - All rights reserved.