Why prototype is required even without any class declaration?

前端 未结 3 1924
故里飘歌
故里飘歌 2021-01-14 00:55

If I just do it: Ex1:

#include 

int main()
{
    //try to call doSomething function
    doSomething();
}

void doSomething(         


        
3条回答
  •  梦毁少年i
    2021-01-14 01:46

    You can't call a function without the compiler having seen either the definition or a declaration, first -- simple as that. A prototype or the actual definition must appear before a call.

提交回复
热议问题