0

I'm getting the following error:

helpers.c:25:12: error: called object type 'int *' is not a function or function pointer
        if (MIN < MAX)
                  ^~~
helpers.c:20:24: note: expanded from macro 'MAX'
        #define         MAX             (values(n - 1))
                                         ~~~~~~^

How do I make this possible?

bool search(int value, int values[], int n)
{
        #define     MAX         (values(n - 1))
        #define     MIN         (values[0])

        //if (max < min):
            //return -1
        if (MIN < MAX)
            printf("Yes!\n");
}
0

If you define MIN and MAX as constant ints rather than using #define, you will be able to control whether they are reference or value types.

const int MAX = (values(n - 1));
const int MIN = (values[0]);
| improve this answer | |
  • It didn't work. Here is what I got: helpers.c:20:25: error: called object type 'int *' is not a function or function pointer const int MAX = (values(n - 1)); ~~~~~~^ – Salamit Dec 27 '16 at 13:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .