🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
Return types
Return types are the pendant of parameter types. When you call a function, you have to give it parameters of a given type. Well, if that function returns a result, the return type is ... the type of the value it returns.
e.g. double foo( int x ) { return x/2.0; };
The type of x is int, the return type is double, which means that when I type foo( 5 ), the value I get is a double, and I should store it in a variable of type double (unless I really know what I am doing).
e.g. double foo( int x ) { return x/2.0; };
The type of x is int, the return type is double, which means that when I type foo( 5 ), the value I get is a double, and I should store it in a variable of type double (unless I really know what I am doing).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement