[Solved] How to avoid retaining string values in C in function calls


I want to reset the value of the char[] newer everytime my new function is called.

All you need is to initialise it properly:

char newer[45] = "";

As a general rule, you should always initialise local variable before using it. Failing to do so will usually lead to unexpected behaviour as you’ve seen in your code.

13

solved How to avoid retaining string values in C in function calls