275 views
0 votes
0 votes
#include <stdio.h>
int atoi(char s[]) {
        int i, n;
        n = 0;
        for(i = 0; s[i] >= '0' && s[i] <= '9'; ++i)
                n = 10*n + (s[i] - '0');
        return n;
}
int main() {
        char s[] = "jitendra";
        int number = atoi(s);
        printf("%d\n", number);
        //printf("%d\n", atoi(s));
        return 0;
}

 

Please log in or register to answer this question.

Related questions

2 votes
2 votes
0 answers
3
0 votes
0 votes
2 answers
4