arrays in functions where the size is a formal argument

HI there,

I'm new to both this forum and to C programming so apologies in advance if my question is answered in the FAQ or elsewhere but I could not find it.

I would like to do the following:

within a function (other than main) definition I would like to declare an array of size equal to some number that is a formal argument of the function itself. So if "n" is a formal argument of FUNCT, say, I would like to locally (within FUNCT) declare an array of size n.

This seems a fairly reasonable thing to do and I am sure there must be a trick - but I can't get it to work. I have tried dynamic memory allocation using malloc to no avail.

Thanks in advance for any comments anyone may have.

Boggle