I have following thing which i wanted to convert to int.
char *ptr; // this can point to variable length of string
int balance = functionToConverIntoint(ptr)
So is there any such function in C “functionToConverIntoint” which can do this job?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Check out strtol() and strtoul().
You want to avoid atoi() as it does not have a good way of distinguishing between a string of “0” and an invalid number.