# One question about array and function prototype declaration

Printable View

- 11-27-2007
  whichet
  One question about array and function prototype declaration

  > Hello all, do you think this below code will be compiled and work???
  > I used VS 2005 and it did not work. but I haven't tried any other compiler yet!!.
  > I will have to take exam about C programming. and the exam instruction says that I am not allowed to make change to any function signature!!
  > Code:

  > `#include <stdio.h>
  > int foo (int [] a);
  > int main()
  > {
  > //... more code...
  > return 0;
  > }
  > int foo (int[] a)
  > {
  > }`

- 11-27-2007
  MacGyver

  > Try putting the [] after the variable name.
  > Edit: And return an int from your function.

- 11-27-2007
  whichet

  > Quote:

  > Originally Posted by MacGyver
  > Try putting the [] after the variable name.
  > Edit: And return an int from your function.

  > yeah, RIGHT!!!
  > Code:

  > `int a[]`

  > is the correct form in C!
  > However, I am asking them to clarify about that.