but i have a little problem in the main program, when i call the function i have this error: Use of undeclared identifier 'n', and when i try to declare it in main program, then function doesn't work..Does someone know what's the problem and how to fix this?
and when i try to declare it in main program, then function doesn't work.
"Doesn't work" is the most useless problem description there is. Tell us clearly, precisely and completely what behaviour it is that you're seeing, and how that behaviour differs from what you expect to see.
Also, it's likely that we won't be able to help fix the problem without seeing the actual code of your function.
EDIT: I notice you were told more or less exactly the same things in the last thread you posted. Why are you failing to learn from the help you're being given here?