I need an explanation of correct use of pointers within functions.
say i had a structure like this:
Code:
#include <stdio.h>
#include "my.h"
int main(void)
{
int length, width, customerdiscount, area;
double costpersquarefoot, carpetcharge, laborcharge, installedpricecharge, discountcharge, subtotalcharge, taxcharge, totalcharge;
read_data(&length, &width, &customerdiscount, &costpersquarefoot);
calculate_values(length, width, customerdiscount, costpersquarefoot, &area,
&carpetcharge, &laborcharge, &installedpricecharge,
&discountcharge, &subtotalcharge, &taxcharge, &totalcharge);
printresults(length, width, area, carpetcharge, laborcharge, installedpricecharge,
discountcharge, subtotalcharge, taxcharge, totalcharge, costpersquarefoot);
return 0;
}
when I call these functions. the first calls no other functions, the second calls 3, and the print calls 2... if they are going to change in the function i use *variablename, if not then its variablename? also when a function looks like this:
void calculate_total (double* variable1, double* variable2, double variable3, double variable4,)
{
variable1 = variable3 * variable4;
variable2 = variable3 + variable4;
return;
}
how do i refer to it when i bring it back into main to use with all of the other functions?