What you're trying to do is create a sort of generalized function that takes arguments of some type and returns the larger value, in the same type.
Problem is, you actually can't do this in C. Although it's true that several C primitive types can be compared using the same kind of >
logic, not all of them can be compared meaningfully like that, and even if they could, the compiler won't let you do this-- there's just no way to say "argument with unknown type" and "return whatever type the argument was".
C requires you to define the type explicitly, which usually means creating a different version of this function for every type you want to support. In other words, make a better_int
function, and a better_float
function, etc, and then call the appropriate one.
In this case, it's also possible to use other compiler features, called macros, to essentially autogenerate this comparison code for you right before compiling the code. This can achieve your goal, but doesn't do it with pure C constructs. Feel free to ask more about this approach if you still want to solve this problem this way.