query Regarding Function in c++

charan's Avatar, Join Date: May 2007
Newbie Member
Hi ,

I have two query regarding c++ function.In C,By default the default return type of a function is void and of main() is int.Do the same thing happens in c++,and
Secondly ,can we in c++ define a function without declaring it earlier.means is function declaration mandatory in c++ or not.
Hope i will get a response..
Thanks
Charan
0
DaWei's Avatar, Join Date: Dec 2006
Team Leader
The default return type of a function in C is not void, but int. The return type of main is int for both languages. Function declarations (or definitions prior to use) are mandatory in C++, which is a more strongly typed language.
0
charan's Avatar, Join Date: May 2007
Newbie Member
Thanks Dawei.
0
mandar's Avatar, Join Date: May 2007
Newbie Member
hello,
The function declaration in C++ is always mandotory. and all the default function return types in c are integers. mind u those are not void.


Regards.. Mandar
0
DaWei's Avatar, Join Date: Dec 2006
Team Leader
The function declaration is not mandatory in C++ if the fuction definition precedes the first use of the function.