c - Can we call functions before defining it? -


#include <stdio.h>  void main()  {      m();  }  void m()  {      printf("hi");  } 

output

hi

warnings

main.c:11:10: warning: conflicting types 'm' [enabled default]      void m()           ^ main.c:7:9: note: previous implicit declaration of 'm' here          m();          ^ 

why program runs though m() called before defined? , meaning of warning?

c89 allow implicitly converting return type of function , parameter passed int. see here.

but, not valid in c99 , later. has been omitted standard. either have declare prototype function or define before main. see result here. there compile time error in case.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -