Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   query Regarding Function in c++ (http://www.go4expert.com/forums/query-regarding-function-cpp-t4421/)

charan 25May2007 12:19

query Regarding Function in c++
 
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

DaWei 25May2007 13:30

Re: query Regarding Function in c++
 
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.

charan 25May2007 16:27

Re: query Regarding Function in c++
 
Thanks Dawei.

mandar 25May2007 17:15

Re: query Regarding Function in c++
 
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

DaWei 25May2007 17:51

Re: query Regarding Function in c++
 
The function declaration is not mandatory in C++ if the fuction definition precedes the first use of the function.


All times are GMT +5.5. The time now is 05:18.