In C, there is no difference between rules for declaring and defining function and variable. So we can define the functions inside another function, but their scope is limited to that function only, In this example abf() is local function to abc(), it can't be accessed outside environment.
On Wed, Oct 3, 2012 at 1:06 AM, rahul sharma <rahul23111...@gmail.com>wrote: > Guys i have read that we cant define function in another function in c > Then why this followung program running fine on gcc > > #include<stdio.h> > void abc() > { > printf("bac"); > void abf() > { > printf("bas"); > getchar(); > } > } > int main() > { > abc(); > getchar(); > } > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Regards: -------------------- Kranthi Kumar D -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.