Hi there, I have a problem in finding where is the mistake in my code.The problem is that I am not getting correct output of printf. As you can see I am derefferencing the pointers pd_f and pd_C in the brackets just before they are multiplied.
The problem is removed when I declare new local variables assign the derefferenced values of the pointers to them and I use these new local variables in the expression instead of the pointers. I think it has to do with precedence and associativity, but I have now clue what is wrong. The brakets has the highest precendence so that means the pointers gets derefferenced first and then multiplied...?

double computeValuesAndDisplay(const double* pd_R,const double* pd_C, const double*pd_f)
{

    if ((*pd_R==0)&&(*pd_C!=0))
    {
        printf("The pure reactance of the circuit is %.3e Ohms\n",
                1.0/(2*M_PI* (*pd_f)*( *pd_C)));

    }

Recommended Answers

I just marked it as solved.

Jump to Post

All 2 Replies

how to delete this submission, I just found that there is no problem?

I just marked it as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.