0

I want to convert this: int number = 12345678; to uint8_t numarray[] = "12345678";

How to make this possible? I will really appreciate your help.

  • Why `uint8_t` rather than `char` which is the normal type for a string? Anyway, use [snprintf](https://linux.die.net/man/3/snprintf) – kaylum Oct 06 '22 at 05:30
  • I think you might be looking for this: https://stackoverflow.com/a/8257728/19592428 – Pavel Savchuk Oct 06 '22 at 05:35

1 Answers1

0
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
int main()
{
    
    int number = 12345678;
    
    char numberArray[10] = {0};
    
    itoa(number,numberArray,10);
    
    printf("Number Array = %s",numberArray);

    return 0;
}

I think this code will do what you want