I dont know the declarations a protocols in this.

Ok i dont know where the erroro is and i feel reaallly stupid for not knowing.


#include <stdio.h>

int pntr_mix(int*,int*,int*,int*,int*,int*) ;

int main()
{
int value_a, value_b, value_c ;
//int *pntr_a ;
//int *pntr_b ;
//int *pntr_c ;
int sum_ab, sum_ac, sum_bc , sum_abc ;

value_a = 13 ;

value_b = 25 ;

value_c = 27 ;

// **** Initialize the pointers pntr_a, pntr_b, pntr_c : Instruction # 1

int *pntr_a = &value_a;
int *pntr_b = &value_b;
int *pntr_c = &value_c;
// **** Modify the argument list for this function call : Instruction # 2

sum_abc = pntr_mix(pntr_a, pntr_b, pntr_c, &sum_ab, &sum_ac, &sum_bc) ;

// **** Make no changes to the following printf() statements : Instruction # 3

printf("THE SUM OF A + B IS : %d \n\n" , sum_ab ) ;
printf("THE SUM OF A + C IS : %d \n\n" , sum_ac ) ;
printf("THE SUM OF B + C IS : %d \n\n" , sum_bc ) ;

printf("THE SUM OF A + B + C IS : %d \n\n" , sum_abc ) ;

printf("END OF PROGRAM EXECUTION: pntr_lab_211() \n\n") ;

return 0 ;

} // end of function main()


// **** Write the correct code for the function definition for function pntr_mix()
// **** Instruction # 4

int pntr_mix(int sum_ab, int sum_bc, int sum_ac, int *pntr_a, int *pntr_b, int *pntr_c )
{
sum_ab = *pntr_a + *pntr_b;
sum_bc = *pntr_b + *pntr_c;
sum_ac = *pntr_a + *pntr_c;





return sum_abc ;

} // end of function pntr_mix
This function definition
1
2
3
4
5
6
7
8
9
10
11
12
13
int pntr_mix(int sum_ab, int sum_bc, int sum_ac, int *pntr_a, int *pntr_b, int *pntr_c )
{
sum_ab = *pntr_a + *pntr_b;
sum_bc = *pntr_b + *pntr_c;
sum_ac = *pntr_a + *pntr_c;





return sum_abc ;

} // end of function pntr_mix 


does not match the function prototype:
int pntr_mix(int*,int*,int*,int*,int*,int*) ;


Also, the parameter order you call the function does not match:
sum_abc = pntr_mix(pntr_a, pntr_b, pntr_c, &sum_ab, &sum_ac, &sum_bc) ;

All in all, it is very confused
Last edited on
Topic archived. No new replies allowed.