I have a function print_number.
The function checks if in front of the number there exists '-', then it reverse the number and takes every digit and prints it. The algorithm works pretty good but if i give -2.147.483.648 ( which should be the bottom limit of an integer ) it pritns -0 and i don't know why.
#include<stdio.h>
void    print_char(char character)
{
    printf("%c",character);
}
void    print_number(int nr)
{
    int reverse=0;
    if (nr < 0)
    {
        print_char('-');
        nr *= -1;
    }
    while(nr > 9)
    {
        reverse = reverse * 10 + nr % 10;
        nr = nr / 10;
    }
    print_char(nr + '0');
    while(reverse)
    {
        print_char(reverse % 10 + '0');
        reverse = reverse / 10;
    }
}
 
     
     
    