10 – Function Signatures 2

So with the Test-Normalized function we had the return-type bold, the name Test-Normalized, open and closed parenthesis, but I imagine this isn’t the total picture because this function didn’t take any arguments. That’s true. And if it was in a header file instead of that open curly brace you would have a semicolon to say this is the function declaration instead of the definition. And if we wanted to take arguments it would be in those open parenthesis. Take this other function, Normalize, where you have this kind of complicated signature, function signature, where have vector, vector float and then normalize in vector vector float. And what that says is that you want to return this vector vector, so the grid of floats and you want to normalize, that’s just your function name, and then inside you have another grid. When you switch it so that you are not necessarily passing it the same way and copying it, you’ll find that you don’t need all of those parameters.

%d 블로거가 이것을 좋아합니다: