double equation_count(int count, double number, ...){ double *p_number = &number, result = 0; int i; for(i=1; i <= count; i++){ result+= pow(*p_number,i); p_number++; } return result; } printf("%g",equation_count(2,2.0,3.0)); The function must return the sum of real numbers in i degree.
In this case, the result should be 11 , but returns 1 . The problem is somewhere with the data type, because with integers, the function works.
double *p_number = &number;. I often see this. Where does this come from? - AnTsize_tandunitptr_t. - AnT