String to integer

I am using string instead of char,
Is this code is correct?
and if there is any mistake pls let me know

@aattuull,
Seems fine, also you can input string like 1234, and check if that comes in output as well.