2

storing a value in an uninitialized variable is the same thing as initializing that variable. a local variable, for example, does not have a default value when it is defined. any value may be in there. using that variable before ensuring that one of the values that your program expects is in there may cause your program to produce weird results or crash. ...


1

You initialize string initial = NULL But in your 2nd for loop, you set n=strlen(initial)


Only top voted, non community-wiki answers of a minimum length are eligible