My doubt is that, the program works fine if I enter a password that fills the array. However if I enter a password such as \"apple25\", I think it counts the blank spaces in the
Try entering a password with a size of 10 or longer. You'd overflow arr.
You don't stop at the terminating NULL character (value 0). In fact, you count the terminating NULL as "character" and increase c when you come across it.