X
Xiaoshen Li
Dear All,
I am confused with prototypes in C. I saw the following code in a C book:
void init_array_1(int data[])
{
/* some code here */
}
void init_array_2(int *data_ptr)
{
/* some code here*/
}
int main()
{
int array[MAX];
void init_array_1();
void init_array_2();
/*some code ommited*/
return (0);
}
I don't understand why we need the two lines of function declarations
inside main:
void init_array_1();
void init_array_2();
Normally I would put them before main() and put those function
definitions after main. If the two functions block have been put before
main, I would thought no function declarations are needed any more.
Thank you very much.
I am confused with prototypes in C. I saw the following code in a C book:
void init_array_1(int data[])
{
/* some code here */
}
void init_array_2(int *data_ptr)
{
/* some code here*/
}
int main()
{
int array[MAX];
void init_array_1();
void init_array_2();
/*some code ommited*/
return (0);
}
I don't understand why we need the two lines of function declarations
inside main:
void init_array_1();
void init_array_2();
Normally I would put them before main() and put those function
definitions after main. If the two functions block have been put before
main, I would thought no function declarations are needed any more.
Thank you very much.