Hi all.
I need help in emptying an array completely.
I searched and saw that the usual way to go was overwriting all the elements of the array with zeros but this doesn't help in my case.
I need it to be completely empty as at when declared.
Fully explained: I'm working on changing a password. But the old password needs to be entered and verified. It is entered into an array (which was declared with just size but no elements) and compared with the array containing the password that is currently being used. If the old password is correct, it moves to the next step of accepting a new password. If not, it displays a message that the password is not accepted.
When doing this the first time, it works probably because the array was just filled. But on subsequent trials, it jumps straight to tell you that the password isn't accepted. I think this is because the previous elements still exist in the array. If I were to overwrite the contents with zeros (which I did using the memset function), it'll still do the same because it sees the zeros as the old password which doesn't correlate with the running password.