Abstract Algebra – "Lift" an algebraic structure on a codomain domain from the set of functions that compose it.

Let $ S $ to be a whole and $ G $ to be a group. The set of functions of $ S $ at $ G $ is clearly also a group. The identity element is the constant function whose value is the identity of $ G $, and the inverse (group) of any function $ g $ is the function that maps $ x in S $ to the reverse group of $ g (x) $ in $ G $.

If we replace "group" by ring, vector space or algebra (assuming that a scalar field is given for the last two), the analogous statement is always true.

This is clearly not the case for fields however. Assuming we want it to work, the "zero function" would be the one that matches zero. A function $ f $, such as $ f (x) $ is $ 0 for at least one $ x in S $but is do not $ 0 for at least one other $ x in S $, is not equal to the zero function, but does not have a multiplicative inverse either.

Are there any other algebraic structures for which this relation is valid or faulty in an interesting way? Is there a specific area of ​​mathematics that studies this?