I just found what was the error

When Salem told me to change all values to n i have a const TAM with 100...so this was giving me segmentation default.

Now i'm trying to improve that function because is not working like i want