I need to keep on adding arr2 until arr is done...But if i do in the above way only the last element in the array arr2 remains . Others would be overiden.. This suppose to be something simple... but i just donot know how to increment the for....??? Pllease help me...!!! [ July 13, 2006: Message edited by: catherine matthews ]
A little confused here as to what you're trying to do but I think I can help get you headed in the right direction. First of all, try to use the code tags (see the "code" button below the message edit screen when posting) around your code. It makes things easier for people to read which means it's easier for people to understand and help.
Your for loop headers are not formed correctly. The for loop header should contain: initializer, condition, update. In your case the condition and update look fine but the initializer is not correct. "i<0" is not initializing the loop variable "i".
What does the CALLCLASS[i] statement do? Or rather, what's it supposed to do? Also, where do arr and arr2 come from?
Just a little more explanation and context is needed then we can help more.
this is the code..... well to put it simply how do i keep on incrementing the inner loop arrays....? for all the incremnets of the outer loop? without overiding... if inner loop has 4 loops for every outer loop that has 2 loops.... at the end i must get 8 elements within the inner loop array.... How do i go about??? please help me...
EDIT by mw: Corrected code tags, leaving indentation as originally posted. (It's a forward slash on the closing tag. ) [ July 13, 2006: Message edited by: marc weber ]
i think the problem is that when you loop back in your outer loop, you are resetting p to 0, thus overwriting the first few elements. if you initialize p outstide of both loops (or even intialize p with i in the outer loop), then DON'T intialize it in the inner loop, you might get what you want.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joined: Dec 15, 2005
I'm still pretty confused about what you're trying to do here. Since your question seems to revolve around the for loops I'll explain what you have going on in the code and maybe that will shed some light. Your code shows three for loops:
The first loop uses "i" as the loop index. It starts at 0 and goes to CallClass.length. This outer loop will execute that many times. The next loop uses "is" as the loop index. It starts at 0 and runs "methodlen" times. "methodlen" is set by calling getMethods() on the clsCouple object. The inner most loop uses "ns" as the loop variable and it executes dataType.length times unless the "break" kicks in. This happens when "m" > -1. Since "m" is set using the indexOf method I'm assuming that this loop is meant to break out as soon as the there is a match. That's what will happen.
Hmm. Maybe that's the problem you are seeing. Do you want the inner loop to stop the first time a data type is found in the method string or are you wanting to see all of the dataType matches in the string? If you are wanting to see all of the matches then you need to remove the break statement. Generally speaking break statements in loops are a bad idea. There is almost always a better way to do things.
Well, I'm not sure if my comments have helped at all. Maybe you can clarify what you're trying to do and where things are going wrong.
Joined: Jan 22, 2006
thanks all... Actually my problem is simple... i guess i made it very confusing... the use of dynamic array cleared all my pronblems...
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com