Because in C++ we need to declare the function before using it. With keyword inline...the complete code of the function is replaced wherever it is called. I hope now its clear why the above code is not working.
On Wed, Jun 8, 2011 at 9:32 AM, nicks <[email protected]> wrote: > Check this is working fine.. > > int g() > { > return 1; > } > int f(){ > g(); > return g()+1; > } > int main() > { > g(); > f(); > } > > > On Tue, Jun 7, 2011 at 12:29 PM, sourabh jakhar > <[email protected]>wrote: > >> int main() >> { >> >> g(); >> f(); >> } >> >> inline int f(){ >> g(); >> return g()+1; >> } >> inline int g() >> { >> return 1; >> } >> this code works but if removed inline than gives run time error can any >> one explain >> -- >> SOURABH JAKHAR,(CSE)(3 year) >> ROOM NO 167 , >> TILAK,HOSTEL >> 'MNNIT ALLAHABAD >> >> The Law of Win says, "Let's not do it your way or my way; let's do it >> the best way." >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
