|
-
Dec 14th, 2003, 05:10 PM
#1
Thread Starter
Member
Print array by column help.
I have two arrays:
Code:
int array1[][] = { { 1, 2, 3 },
{ 4, 5, 6 } };
int array2[][] = { { 1, 2 },
{ 3 },
{ 4, 5, 6 } };
I need to print both of them by column like this:
Code:
14
25
36
and
134
2 5
6
I can do the first one, but I don't know how do do the second one using array.length and array[ row ].length. How do I do this? Thanks
-
Dec 15th, 2003, 04:59 AM
#2
First you need to find the longest of the subarrays. That's your base length and loop count.
Then on each iteration you simply check if the current subarray still has elements.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
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
|