The new forums will be named Coin Return (based on the most recent
vote)! You can check on the status and timeline of the transition to the new forums
here.
The Guiding Principles and New Rules
document is now in effect.
Woes with C (incompatible assignment...and threads).
Posts
Dynamic arrays need to be malloc'ed before they can be used as arrays.
should be
ready_trains = traintest
assuming both are arrays
this
What you want is ready_trains to be a dynamic array of pointers to train structs
train **ready_trains, and malloc accordingly.
God C is a confusing language.
That looks like a buffer overflow.
This part in your thread creator area: as I see is suppose to look more like:
Because temp is being assigned within your loop, you don't need to allocate it individually:
Then you can use the fix Bob Sapp gave you. At the moment, if you use Bob's code without the changes, it looks like you're allocating temp instead of allocating readytrains to the appropriate size, which might segfault or give bad data.