>>Can you show a loop that will copy each element?
Element of the struct: no, can't be done.
Element of the array: yes, already done in this thread.
>>Can you show a loop that will copy each element?
Element of the struct: no, can't be done.
Element of the array: yes, already done in this thread.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
hammer please read my last reply I changed it since you read it and replied to it...
>>will this copy the data to elements 50 through 99 in big_car_buf.cardata[i] ?
Well, assuming you overlook the fact that I made a small error (i should be declared outside the first for loop, otherwise I think it goes out of scope before this), yes it does - i leaves off at 50, and the second loop continues from there to 99.
Just Google It. √
(\ /)
( . .)
c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.
In this bit of code, i is not re-initialised, therefore it will hold the value 50 as it did when it left the previous for loop. So, this loop will copy from elements 0 to 49, to elements 0 to 50 to 99.Code:for(; i < 100; ++i) big_car_buf.cardata[i] = car_buf2.cardata[i - 50];
I would also recommend a minor change to the supplied code. I would declare i outside of the first for loop, not within it. This would ensure that it stays in scope for use in the next for loop.
[beat! - maybe I should duck out of this one ]
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
hammer thanks...sorry for being so hung up on memcpy and more importantly for being a bonehead!
>>hammer thanks
thank hunter2, I was only butting in !
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
sorry about that...it's late! thanks hunter!