This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Can't use sprintf unsigned



I am trying to write an array of adc values in ascii format one decimal value at a time.  I am able to get the below code to work fine when I use "%d".  However, I need the values to be unsigned.  When I use "%u", though, sprintf writes nothing but 0x00 in my result array.

Any idea why this is happening and how I can get my values unsigned??

Thanks!

 

unsigned adc[10];

        for(i=0;i<10;i++)
        {
            char result[10] = {0};
            unsigned num = adc[i];
            sprintf( result, "%u", num );

            Write_Result(result);

         }