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

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -