Strtoint and IntToStr

Source: Internet
Author: User
Convert str to int   int strtoint (char str[]) {  int i=0;   int isneg = 0;   int num =0;     if (str[0]== '-')    {        Isneg = 1;     i =1;   } &NB Sp    while (Str[i])    {     num*=10      num+= (str[i++]-' 0 ');   }      if (Isneg)      num*=-1;      return num;     convert int to str   #define Max_digitis_int   void inttostr (int num, char str[]) {   int i=0,j=0,isneg=0;    Char Temp[max_digitis_int + 2];      if (num<0)     {      num*=-1;       Isneg = 1;     }       do     {      temp[i++] = (num%10) + ' 0 ';       num/= 10;    }while (num);       if (Isneg)        temp[i++]= '-';       while (i>0)       str[j++] = temp[--i];       str[j]= ' "; }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.