'How can I check if 2 different implementations (with same name) of a function agree in C?

I have a header interface.h with a function f() and its two implementations, imp1.c and imp2.c. Both imp1.c, and imp2.c contain definitions for f(). I am checking f() with random inputs, but I want to make sure that the outputs from both imp1.c and imp2.c agree. How can I do that? Is there any way my main function can distinguish between the two implementations? Like

if(imp1.f() != imp2.f()) printf("The implementations differ on input %d", i);
c


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source