Anyway, the problem is that v[] in main is created and is filled with garbage. You call the function, and dynamically allocate some space, fill in some data, then free it (all unrelated to v[]). This has accomplished nothing, as when you return to main() none of that matters.
Why are you dynamically allocating at all? You already have an array in main(), just use that in the function.
I am dynamically allocating because i make this program as a homework for school!
Regarding the code tags.i am sorry!i will be more carefull in the future!
Thanks for your help!