Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uint8_t ret=0;
- char str[64]; // TODO use malloc over length here !!
- char c;
- // char ** str = (char **) malloc(length * sizeof(char *));
- unsigned int iter=0;
- for (iter=0; iter<length;iter++)
- {
- int sublength;
- itoa(array[iter],&c,10,&sublength);
- str[iter]=c;
- printf_("itoa of %d = %d ; str[%d] now is %d \n\r",iter,c,iter,str[iter]);
- }
- //Now the first length character of str are the number (e.g if array= {4,5,6} then str should be {'4','5','6','whatever','whateve',...}
- for(i=0;i<length;i++)
- {
- printf_("buffer[%d]= %d\n\r",i,str[i]);
- }
- Output:
- itoa of 0 = 48 ; str[0] now is 48
- itoa of 1 = 49 ; str[1] now is 49
- itoa of 2 = 54 ; str[2] now is 54
- buffer[0]= 0
- buffer[1]= 49
- buffer[2]= 54
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement