ok, i've created a typedef of somthing, and I put it through a for
loop to put the entries into it. They are stored as an array of the
typedef''s, with memory allocated via malloc command.
For some strange reason, one of the strings that make up the typedef,
ends up being exactly the same in every typdef in the array (and it
shouldn't). Ive been debugging and using printf's to view the before
and after values of this particular string, and all is well (they are
different for each typedef), but then 2 lines later i wrote another
small forloop for debugging to print that particular string out for
the entire array, and they are all the same! and the value they are,
is the last string value in the last entry of the array.
The two lines of code inbetween are as follows:
k++;
// which is an increment for the for loop
if (k == NUM_BUTS)
// which just tests for when the array is finished.
these two lines of code can't possibly alter one particular string
value in the entire array of typedefs. So what is going on? its acting
as if there is only one entry in the array and it defaults to the last
value that was set to it, except the other variables in each typedef
are all different as they should be.
Can anyone help? would this have anything to do with the memory
allocation, i using malloc, and free.