引用:
#include <stdio.h>
int x=10;
int myfunc(void);
int main(void)
{
int y=x;
int z = myfunc(y);
printf("%d %d",y,z);
return 0;
}
int myfunc(int i)
{
return i/2;
}
|
myfunc(y)紅字的部份編譯器說too many arguments to function "myfunc",這是照課本上抄的程式,為何有此錯誤?
那該如何寫?
我有試著把myfunc(y)的y拿掉變成myfunc(),但編譯器編到 int myfunc(int i) 又說 [Error] conflicting types for 'myfunc'
please help, thanks.