How to pass one dimensional array to functions in C?

An array can’t be passed as an argument to a function. To pass a one dimensional array to a function a pointer to an array can be used by specifying array name without an index:

void main ( )


int a[20];






Formal parameters can be declared by any of the three ways:

1) As a pointer:

function1(int *a)

2) As a sized array:

function1(int a[10])

3) As a unsized array:

function1(int a[])

Leave a Reply