Fraser Price
Fraser Price

Reputation: 909

Pointer to standard C operators

I am trying to implement some code that requires pointers to standard C functions. I am currently using a workaround that looks something like this:

uint32_t add(uint32_t op1, uint32_t op2) {
    return op1 + op2;
}

sum = (&add) (x, y);

I was wondering if there are pointers to standard functions such as +, -, &, etc.?

Upvotes: 1

Views: 93

Answers (1)

George
George

Reputation: 1380

+,- etc are not functions in C. They are operators. pointer to function is a commonly used feature in C. But pointer to an operator is not possible.

languages like C++ allows you to override an operator. May be this will be useful for you.

Upvotes: 1

Related Questions