If we have two function e.g A and B. And we call function B in the function A. Is it necessary to define function B before defining function A?
            Asked
            
        
        
            Active
            
        
            Viewed 94 times
        
    -3
            
            
        - 
                    3Why don't you just try it? It's faster. – İsmet Alkan Jan 23 '14 at 14:31
3 Answers
7
            
            
        No, you can declare the functions and define them afterwards.
//declarations
void foo();
void goo();
//definitions
void foo() { goo(); }
void goo() { foo(); }
//...
foo(); //stackoverflow, but hey, it compiles
 
    
    
        Luchian Grigore
        
- 253,575
- 64
- 457
- 625
1
            
            
        There are no such dependency. You can refer this link.
Particularly, in case of DLL when we are using function pointers. we need to store the address of the function at runtime only after library gets loaded (LoadLibrary()).
 
    
    
        Community
        
- 1
- 1
 
    
    
        Rasmi Ranjan Nayak
        
- 11,510
- 29
- 82
- 122
0
            
            
        Function declarations
void B();
void A();
Function definitions
void B() 
{ 
    A(); 
}
void A() 
{ 
    B(); 
}
//...
A();
I hope your question will be clear by this code.
you can implement in this manner.
 
    
    
        Govinda Rajbhar
        
- 2,926
- 6
- 37
- 62
 
    