473,396 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

1D array values into a 2D array

I have been breaking my head by taking array[16] and passing it's values to arrayTwo[4][4], I'm trying to use a for loop for this, but it's just driving me crazy...can any body help me.

Thanks.
Jan 29 '06 #1
4 9738
Niheel
2,460 Expert Mod 2GB
Paste your code here; so that we can check it out. Use the CODE tag so that your code displays properly.

Thanks
Feb 3 '06 #2
I got it...thanks for the help anyways...if you still want the code I did, let me know...when i get home I'll post it here.
Feb 3 '06 #3
Niheel
2,460 Expert Mod 2GB
Sure, it would be greatly appreciated. It could help another developer.

Thanks
~ KUB
Feb 3 '06 #4
Ok, I did it a function. that takes 3 parameter. The first is an array called list and listSize is a constant with the value of the 16 elements. Since it's an array, the value is 15.

matrix is the 4 by 4 array that we want to pass the values into.

row is the number of rows.

here is the function.


void matricize(int list[listSize], int matrix[rows][columns], int rows)
{
//INPUT THE VALUES OF ONE-DIMENSION ARRAY INTO THE TWO-DIMENSION ARRAY
int listSize=0;

for (int counter1 = 0; counter1 < rows; counter1++)
{
for (int count=0;count < columns; count++)
{
matrix[counter1][count] = list[listSize];
listSize++;
}
}
}

thanks for you help KUB
Feb 10 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Sue Adams | last post by:
I have a form on an asp page and am trying to write the code to place the values of all checkboxes that have been selected, into an array. The checkbox values will be used in a dynamic sql statement...
2
by: csx | last post by:
Hi all, Here's a simple problem I'm having problems with. How do I pass an array element to a function. For instance, values = new values(1, 1,'A',0); values = new values(2, 2,'B',1);...
47
by: VK | last post by:
Or why I just did myArray = "Computers" but myArray.length is showing 0. What a hey? There is a new trend to treat arrays and hashes as they were some variations of the same thing. But they...
8
by: Tweaxor | last post by:
Hey, I was trying to figure out was it possible in C to pass the values in an array from one function to another function. Is the possible in C? ex. y is the array that holds seven values If...
9
by: buda | last post by:
Hi, I've been wondering for a while now (and always forgot to ask :) what is the exact quote from the Standard that forbids the use of (&array) (when x >= number_of_columns) as stated in the FAQ...
1
by: Stephen | last post by:
Was wondering if someone could please help me with an array I'd like to create in an asp.net page. I have to design an array which stores the values of addresses manually entered into textboxes...
11
by: rayreeves | last post by:
How do I declare an array of references to the elements of an array of values? Ray
5
by: Stephen3776 | last post by:
I am doing an inventory control progam and trying to output a multiple array, I am getting an illegal conversion error java.lang.double !d. Can somebody tell me what I am doing wrong or if there is...
2
by: yeshello54 | last post by:
so here is my problem...in a contact manager i am trying to complete i have ran into an error..we have lots of code because we have some from class which we can use...anyways i keep getting an error...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.