::: void init_array_1(); char x; :: :将一个char传递给init_array_1 - 它[编译器]最好不要 抱怨 - 因为我们告诉它忘记了东西! init_array_1(x); } 最后,通常会看到预先提前主要...可能因为 包含文件主要是提供这些,并且*通常*包括在任何 代码之前[虽然没有真正的原因要做到这一点 - 只要在使用之前就看到了 ]。It''d be interesting to know which book you were using, and what the subjectunder discussion was when this code appeared.What you''ve posted shows two function *definitions* - ahead of main - andtwo differing predecs for those same functions inside of main. However, thelatter predecs change the shape of things - as the *say* that the compiler''sno idea what you''re going to pass to these two functions at runtime. So,they''re somewhat in conflict with the external definitions [and the implicitdeclarations that these make - when they appeared].As they''re seen later by the compiler, the latter predecs essentiallyoverrule the earlier definitions seen?For example ...:::This says that init_array_1 expects an int[] to be passed to it.void init_array_1(int data[]){}int main(void){::: this says ''forget what you''ve heard about this function - you don''t knowwhat it''ll be passed!!!'':::void init_array_1();char x;::: pass a char to init_array_1 - it [the compiler] had better notcomplain - as we told it to forget stuff!init_array_1(x);}Lastly, it is more usual to see predecs ahead of main ... possibly becauseinclude files mainly provude these, and are *normally* included ahead of anycode [although there''s no real reason to do this - just as long as thingsare seen before they''re used]. 我们不是。 We don''t. 我也是。 So would I. 你会想到的。 You would have thought correctly. 我会说''你没有更好的事情可做!''[at 11.00我不喜欢 现实反思 - 所以,我不会说出来! 该死的,哎呀,Ctrl + Z 该死了!I would say ''have you nothing better to do!'' [at 11.00pm] - but I hatereality-reflection - so, I won''t say it!Damn it, oops, Ctrl+Zdamn it again! 这篇关于与函数声明混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
05-27 19:04
查看更多