Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/07/07 23:54
Read: times


 
#142913 - Try This
Responding to: ???'s previous message
unsigned char temp_array[3]={10.5, 40.5, 30.6};

an unsigned char is an 8 bit whole number 0 to 255 aka an integer.
"C" chops of the decimal for you.

float temp_array[3]={10.5, 40.5, 30.6}; will do as you ask.
BUT, floats eat up RAM and ROM and CPU cycles very fast in 8 bit CPUs. Avoid them if any of that concerns you.

Example use:

unsigned int temp_array[3]={105, 405, 306};
unsigned int temp;

and

temp = getHighest(temp_array,sizeof(temp_array));
printf("%5d.%02d \n",temp ,temp );

Also note that printf() is also a large piece of code.





List of 13 messages in thread
TopicAuthorDate
help required with array manipulation in c#            01/01/70 00:00      
   just having formatted            01/01/70 00:00      
   array not float?            01/01/70 00:00      
      Try This            01/01/70 00:00      
         but be sure to comment it carefully!            01/01/70 00:00      
   Why do you keep saying C# ??            01/01/70 00:00      
   Two things that are definitly wrong            01/01/70 00:00      
      Two things wrong with thing 1            01/01/70 00:00      
         Sorry and Thanks            01/01/70 00:00      
   Also..            01/01/70 00:00      
      ...and, 8051 specifically            01/01/70 00:00      
         8051 in C programming            01/01/70 00:00      
            first and second            01/01/70 00:00      

Back to Subject List