Ask your own question, for FREE!
Computer Science 8 Online
OpenStudy (anonymous):

passing the array... please help.. c++ syntax.. 2 dimensional array..

OpenStudy (anonymous):

OpenStudy (anonymous):

@Callisto

OpenStudy (anonymous):

@bbkzr31

OpenStudy (anonymous):

@e.mccormick

OpenStudy (anonymous):

please help guys :)

OpenStudy (anonymous):

@ganeshie8

OpenStudy (anonymous):

@nincompoop

OpenStudy (e.mccormick):

All arrays are passed by reference.

OpenStudy (anonymous):

yes

OpenStudy (e.mccormick):

Well, to get the reference proper for mupltiple dimensions, the size is involved.

OpenStudy (anonymous):

no its still a 2 dimensional array

OpenStudy (e.mccormick):

Here, this has some code samples: http://stackoverflow.com/questions/8767166/passing-2d-array-to-function

OpenStudy (anonymous):

i already know the 2d

OpenStudy (e.mccormick):

The first dimension, you do not need to pass the size of. All others you need to pass the size of. Does not matter if it is 2 or more. You must pass the size of any dimension past the first. Or you deal in pointers an assortment of other ways.

OpenStudy (anonymous):

but the question is how can i pass the col to row

OpenStudy (anonymous):

statement should i put there

OpenStudy (e.mccormick):

Ah, so you are changing dimensions. You will have to handle it in the function.

OpenStudy (anonymous):

and how can i make a statement in the program to make sure no two number have the same of digits

OpenStudy (anonymous):

yes

OpenStudy (e.mccormick):

You will need to make your destination array, then have the friction loop through it is the most straightforward way. Pass it the first element of both. OR If you do not need a copy, just need a pointer, you can set it so the elements of the 2nd point to the elements of the first.

OpenStudy (anonymous):

what?? you're too advance. :( explain it step by step please.

OpenStudy (anonymous):

i only have less than 30 mins left

OpenStudy (e.mccormick):

In psudocode arry1[r][c] arry2[c][r] for i = 0 to r for j = 0 to c arry2[j][i] = arry1[i][j] next j next i A similar method can be done using pointers.

OpenStudy (anonymous):

1 array should be used

OpenStudy (anonymous):

for example num[5][2]

OpenStudy (e.mccormick):

Hmmm... not sure if there is a way to easily swap the pointers of the array. If so, that would certainly do it.

OpenStudy (anonymous):

hmmm.. :/

OpenStudy (e.mccormick):

Yah, I have swapped the pointers to move rows around or columns around, and there are tons of examples for that. It might be the same thing, but swapping the row and column start pointers.

OpenStudy (anonymous):

uhh

OpenStudy (anonymous):

swapping to col to col and arranging it from least to greatest

OpenStudy (anonymous):

do you have??

OpenStudy (e.mccormick):

You can do that with a sort and swapping the pointers of the columns. The entore column is changed when you swap pointers.

OpenStudy (anonymous):

how to input values to first coloum only??

OpenStudy (anonymous):

how to pass the values to second value??

OpenStudy (anonymous):

what statement should i put on the program??

OpenStudy (anonymous):

huhuhu please help :/

OpenStudy (e.mccormick):

Looking for a reference...

OpenStudy (e.mccormick):

Some of it is covered here. later posts have code samples: http://www.physicsforums.com/showthread.php?t=309053

OpenStudy (anonymous):

:/

OpenStudy (anonymous):

its extended by 4 hours..

OpenStudy (anonymous):

i'll get back on it..

OpenStudy (anonymous):

heheh

OpenStudy (anonymous):

thank you @e.mccormick

OpenStudy (e.mccormick):

This might help: http://www.geeksforgeeks.org/turn-an-image-by-90-degree/

OpenStudy (e.mccormick):

Shows the row-col swap.

OpenStudy (anonymous):

@wolfe8 please help :)

OpenStudy (anonymous):

@Kainui please help :)

OpenStudy (anonymous):

@Preetha

OpenStudy (anonymous):

@timo86m

OpenStudy (anonymous):

@Rina.r

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!