473,408 Members | 2,734 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,408 software developers and data experts.

copying a 2-dimension array into another

Hi,. I have an arry like:

float arr[4][5];

I want to copy the content of each element in arr to this array

float target[4][5];

I know if I make this it will work:

for(i=0;i<4;i++)
for(j=0;j<5;j++)
target[i][j]=arr[i][j];
But, How could I make it also with memcpy ??? Or more simple wih another
function ?

Tnx
Johnny
Jun 18 '06 #1
1 1495
johnny <a@a.com> writes:
Hi,. I have an arry like:

float arr[4][5];

I want to copy the content of each element in arr to this array

float target[4][5];

I know if I make this it will work:

for(i=0;i<4;i++)
for(j=0;j<5;j++)
target[i][j]=arr[i][j];
But, How could I make it also with memcpy ??? Or more simple wih
another function ?


include <string.h>

and try: memcpy(target,arr,sizeof(arr));
If arr is a pointer as opposed to array this won't work unless you
make some changes.

--
Ioan - Ciprian Tandau
tandau _at_ freeshell _dot_ org (hope it's not too late)
(... and that it still works...)
Jun 18 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Thomas Lotze | last post by:
Hi, another question: What's the most efficient way of copying data between two file-like objects? f1.write(f2.read()) doesn't seem to me as efficient as it might be, as a string containing...
4
by: Alex Vinokur | last post by:
Copying files : input to output =============================== C/C++ Performance Tests ======================= Using C/C++ Program Perfometer http://sourceforge.net/projects/cpp-perfometer...
13
by: franky.backeljauw | last post by:
Hello, following my question on "std::copy versus pointer copy versus member copy", I had some doubts on the function memcpy, as was used by tom_usenet in his reply. - Is this a c++ standard...
22
by: Matt | last post by:
When browsing a web page a user has the ability to highlight content on a page (by holding down the left mouse button and dragging the mouse over the desired content). Is there a way to disable...
0
by: Dan | last post by:
We debug a VB.Net App that uses compact framework to a DAP Windows CE.Net device. When I debug I would like to only have the EXE copied down. Right now it copies any referrences as well and...
0
by: surya | last post by:
Hi, I need to enable shadow copying network share folder assemblies. Currently if the path is given as the network share folder path, shadow copying is not enabled. Should something special be...
1
by: emilysmith10 | last post by:
I am creating a new database by copying a template .mdb file. This template has assigned permissions for each of it's objects. I know that just by copying the file, I lose these permissions. Is...
2
by: Edhy Rijo [Progytech] | last post by:
Hi All, I am learning VB.NET and building small application that will do the following: 1.. Copy all files from a DVD to a specific folder in the hard drive and overwrite all files always. The...
4
by: antheana | last post by:
Hi there, I have a specific problem, but also wanted to guage everyone's thoughts on copying codes. For less knowledgeable people like myself, I sometimes find i difficult to write code from...
9
by: Mr John FO Evans | last post by:
Am looking at adding structures to an embedded C emulator but am wondering what the standard is for copying structures(ie structa=structb) which contain pointers to memory and which are therefore...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.