Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- char STRING[]= "100";
- int mojatoi(char*ch);
- int main(void)
- {
- printf("%d\n",myatoi(STRING));
- return 0;
- }
- int myatoi(char*ch)
- {
- int number=0;
- int count=0;
- int i;
- while(*(ch++)!='\0')
- count++;
- ch=ch-2;
- for (i=0;i<count;i++)
- {
- number+= (*ch---48)*(int)pow((double)10,(double)i);
- }
- return number;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement