+ 1

Doubt: Before Calling Function,It should not declared If Advance Compiler changing function concepts please tell me

Instead of Function Declaration We can define the function definition global definition

4th Sep 2016, 2:11 AM
KARTHICKRAJA
KARTHICKRAJA - avatar
1 Respuesta
+ 3
You always have to declare a function before the main()-function so that the compiler and linker know what they have to call during program execution. But you can defer a functions definiton (the body of a function) after main(). This is called forward declaration of functions. #include <iostream> void foo(); int main() { foo(); } void foo() { std::cout << "body to forward-declared function which is defined after main" << std::endl; }
4th Sep 2016, 11:24 PM
René Schindhelm
René Schindhelm - avatar