#include <stdio.h>

int ft_atoi(char *str) {
    int i = 0;
    int sign = 1;
    int value = 0;

    while (str[i] != '\0') {
        if (str[i] == '\t' || str[i] == '\n' || str[i] == '\v' ||
            str[i] == '\f' || str[i] == '\r' || str[i] == ' ') {
            i++;
        }
        // 부호 처리
        else if (str[i] == '-' || str[i] == '+') {
            if (str[i] == '-') {
                sign = sign * -1;
            }
            i++;
        }
        // 숫자 처리
        else if (str[i] >= '0' && str[i] <= '9') {
            value = (value * 10) + (str[i] - '0');
            i++;
        }
        else
            break;
    }
    return sign * value;
}


int main(int argc, char *argv[]){
    argc;

    int n = 0;
    char str[100];
    
    while(argv[1][n] != '\0'){
        str[n] = argv[1][n];
        n++;
    }str[n] = '\0';

    int a = ft_atoi(str);
    printf("%d", a);

    
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: