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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/29/06 16:44
Read: times


 
#121313 - Interger to Array and Buffer question
I have 2 question as follow (Using C Program) :


Question 1 :
============

I have a variable declared as a floating point integer and let's say this variable has the data of :

floatnum = 12.34;

My question is how can i split the floating point number into a string of array such that the array is equivalent to :

array[] = { 1, 2, ., 3, 4};

I have tried using sprintf command but it seems that all it does is inserting 12.34 into the Element 0(array[0]) of the array and i dont want that to happen.


Question 2:
===========

Assuming that the array have to be cleared and rewritten with new floating point number every predetermined loop, is it necessary for me to free the array before inputting new value? If yes, how? Can i just use this single line:

free(array);


Thank you very much and i hope that i could get a response as soon as possible because this is very urgent for me!

List of 6 messages in thread
TopicAuthorDate
Interger to Array and Buffer question            01/01/70 00:00      
   Answers            01/01/70 00:00      
      While theoritically it should works...            01/01/70 00:00      
         float conversion specifier on a long            01/01/70 00:00      
            Alright            01/01/70 00:00      
   what is that, never heard of it            01/01/70 00:00      

Back to Subject List