How Types in functions are determined?