Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 01-29-2006, 08:18 AM   #1 (permalink)
Foolygoofy26
Registered User
 
Join Date: Jan 2006
Posts: 3
Foolygoofy26 is on a distinguished road
Talking one array values to a two dimension 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.
Foolygoofy26 is offline   Reply With Quote
Old 01-29-2006, 09:32 AM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,711
redhead is on a distinguished road
Something like this ?
Code:
for(int i=0, j=0; i < 16; ++j)
    for(int k=0; k < 4; ++k, ++i)
        Two[j][k] = array[i];
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001

Last edited by redhead; 01-29-2006 at 10:45 AM.
redhead is offline   Reply With Quote
Old 01-29-2006, 10:47 AM   #3 (permalink)
destin
Java Junkie
 
destin's Avatar
 
Join Date: Mar 2005
Posts: 40
destin is on a distinguished road
Or, a little less complicated:
Code:
for (int i = 0; i < 4; i++)
    for (int j = 0; j < 4; j++)
        Two[i][j] = array[j + 4 * i];
destin is offline   Reply With Quote
Old 01-29-2006, 11:00 AM   #4 (permalink)
Foolygoofy26
Registered User
 
Join Date: Jan 2006
Posts: 3
Foolygoofy26 is on a distinguished road
thanks
Foolygoofy26 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
passing array to embedded sql leialeia Everything SQL ( MySQL, MSSQL, DB2, Postgre, Oracle, etc...) 3 06-17-2005 06:24 AM
Array to pointer to pointer frier Standard C, C++ 8 03-25-2005 06:57 PM
Sorting an array of any Comparable objects plague Java 1 03-14-2005 06:24 PM
Simple reverse programm silex Standard C, C++ 3 01-22-2005 08:03 AM
Return an array with register_globals = off bdl PHP 7 03-10-2003 05:37 PM


All times are GMT -8. The time now is 10:47 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting