|
-
September 26th, 2010, 01:26 PM
#10
Re: Call Array Member in function Help
First, potatoCode, thank you for your concise sample code in post #7. And it's even taylor-made for the OP's question, not just some anonymous copy-paste stuff! 
But I really had to twist my mind a bit to follow what is going on in your demo code in post #10. As you correctly mentioned, this is definitely not the right way to do that, and I hope that's illustrated appropriately by that sampe. BTW: The counter will de facto not be incremented during the path of processing, as it is not passed along when recurring...
M2W, I don't think that using a linked list, whether circular or not, would be a real gain. I agree to potatoCode and think a plain iteration would best fit the scenario. Something like that:
Code:
do {
for (int i=0; i<10; ++i) {
function_two(Block, i); // Implemented non-recursive!
}
} while (/* some condition */);
You may add specific processing for the last element either in main() (preferably in the outer loop) or, based on the value of i, in function_two(), as you like.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|