A function is a homomorphism of sets. Functions are the morphisms in the category Set.
A function is sometimes called a total function to distinguish it from a partial function.
See set theory for more details.
If we regard sets as discrete categories, then a function is a functor between sets. The functoriality structure becomes the property that a function preserves equality:
See the MathOverflow: what-are-maps-between-proper-classes