Unexpected behavior of atoi() function. It is working in some part of my code and returning 0 in other parts, I am using the following code in different parts of application