Lab3/Lab3.c
/*
3. The C library function atoi converts a string to an integer. Write
   your own version of the function, with the signature
   int atoi(char *str)
   Hints:
   * The function isdigit (defined in <ctype.h>) can be used to tell if 
   a character is a digit
   * You can convert a digit c to an integer value using c-'0'
*/
3. The C library function atoi converts a string to an integer. Write
your own version of the function, with the signature
int atoi(char *str)
Hints:
The function isdigit (defined in ) can be used to tell if
a character is a digit
You can convert a digit c to an integer value using c-'0'
3 . The C library function atoi converts a string to an integer . Write your own version of the function with the signature int atoi ( char * str ) Hints : The function isdigit ( defined in ) can be used to tell if a character is a digit You can convert a digit c to an integer value using c - ' 0 '
int my_atoi(char *str) {
    int num = 0;
    while(*str != '\0') {
        if (isdigit(*str) == 0) {
            return 0;
        }
        num = num*10;
        num = num + (*str-'0');
        str++;
    }
    return (int)num;
}
int my_atoi ( char * str ) { int num = 0 ; while ( * str != ' \0 ' ) { if ( isdigit ( * str ) == 0 ) { return 0 ; } num = num * 10 ; num = num + ( * str - ' ' ) ; str ++ ; } return ( int ) num ; }
3.
3 .
//int counter = 1;