열렬히.뛰기

ft_itoa

école 42 > exam02 > exam02 : part4 > ft_itoa

주의점

  • int에서 char로 갈 때 반드시 ‘0’을 더해준다.

    c
    int a;
    char b;
    
    b = a + '0'
    
  • 음수 처리

  • 0 처리

  • int 최소 음수 처리

문제

c
Assignment name  : ft_itoa
Expected files   : ft_itoa.c
Allowed functions: malloc
--------------------------------------------------------------------------------

Write a function that takes an int and converts it to a null-terminated string.
The function returns the result in a char array that you must allocate.

Your function must be declared as follows:

char	*ft_itoa(int nbr);