0

Here's my main

int main () {
         int list1[3] = {5,5,6}; 
         int num = 3;            
        int result;             
       int *arr = list1;
        int maxVar;              
     int *maxVarHolder;                      
         maxVarHolder = &maxVar;

      
        result = sumarr(*arr, num, *maxVarHolder);
         return 0;
 }

Here's the function header:

int sumarr (int *arr, int size, int *max)

Edited by jimbob90: n/a

3
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by mike_2000_17
0

You want the address of the variables list1 and maxVar to go so your summarr function call be like

result = sumarr(arr, num, maxVarHolder);
0

The variables arr and maxVarHolder are already pointers to int, using the star * will dereference those into the int variable they point to. The stars are not correct. This will work:

result = sumarr(arr, num, maxVarHolder);
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.