How to convert String to int in C

前端 未结 4 1472
萌比男神i
萌比男神i 2020-12-04 03:20

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         


        
4条回答
  •  感情败类
    2020-12-04 04:13

    Yes. atoi is a basic one with very limited error handling capability; strtol is a better one.

提交回复
热议问题