Q:

How to convert int into char* in C (without sprintf)

some day, i wanted to convert in C an integer into a char *, this int can be negative.
I wasn't able to use sprintf ,snprintf neither, so how do i do that ?

A:

To roll one's own itoa()-like function, first one must address how to handle memory.  The easiest is to use a large-enough memory for all possible int values (INT_MIN).
The buffer required size is mathematically ceiling(log10(-INT_MIN))+3.  This can be approximated with:
#include <limits.h>
#define INT_STR_SIZE (sizeof(int)*CHAR_BIT/3 + 3)

Then build the digits up one-by-one starting with the least significant digit using %10 and then /10 to reduce the value.
By using a do loop, code catches the corner case of x==0 as at least one digit is made.
This code avoids if (x < 0) { x = -x; ... as negating INT_MIN (or multiplying by -1 leads to int overflow, which is UB.
#include <limits.h>
#define INT_STR_SIZE (sizeof(int)*CHAR_BIT/3 + 3)

char *my_itoa(char *dest, size_t size, int x) {
  char buf[INT_STR_SIZE];
  char *p = &buf[INT_STR_SIZE - 1];
  *p = '\0';
  int i = x;

  do {
    *(--p) = abs(i%10) + '0';
    i /= 10;
  } while (i);

  if (x < 0) {
    *(--p) = '-';
  }
  size_t len = (size_t) (&buf[INT_STR_SIZE] - p);
  if (len > size) {
    return NULL;  // Not enough room
  }
  return memcpy(dest, p, len);
}

With C99 or later, code can handle the buffer creation with a compound literal allowing separate buffers for each mt_itoa() call.
// compound literal C99 or later
#define MY_ITOA(x) my_itoa((char [INT_STR_SIZE]){""}, INT_STR_SIZE, x)

int main(void) {
  printf("%s %s %s %s\n", MY_ITOA(INT_MIN), MY_ITOA(-1), MY_ITOA(0), MY_ITOA(INT_MAX));
  return (0);
}

Output
-2147483648 -1 0 2147483647

