I have two arrays which I am reusing. I found that if I don't use memset, the content from the previous loop will stay in the array, messing up my output. The problem now is that when I try to print the content of the array, it won't print a thing, even though the array is not empty. What could it be causing it and how could i fix it? Thanks in advance. `
else{
while (!feof(fit)){
fgets(text, MAX, fit);
xifrar_frase(text, m_clau, text_xifrat);
fprintf(fit_x, "%s\n", text_xifrat);
memset(text, '\0', sizeof(text));
memset(text_xifrat, '\0', sizeof(text));
}
}
`
I have debugged the code and seen that the mistake is not in the arrays being empty. I am using memset because I found it was the first method that cleared the arrays, if you have a better method I'll happily change it.