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)));

3 Years
Discussion Span
Last Post by mike_2000_17
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.