🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2091

Re: 2-d arrays

#2091
From: Miguel Carrasquer Vidal
Date: Mon, 26 Feb 1996 22:15
22 lines
1019 bytes
dredlich@gulf.csc.UVic.CA (Devin Redlich) wrote:

>If I have a 2 dimensional array x[4][4] and I want to make a copy of all the 
>data in x, in, say, y[4][4], what would be the most efficient way of copying 
>the data?


if x is local or global:

memcpy(y, x, sizeof x);

if x is a parameter and you _know_ it's 4x4:

memcpy(y, x, 4 * 4 * sizeof x[0][0]); 


==
Miguel Carrasquer Vidal                     ~ ~
Amsterdam                   _____________  ~ ~
mcv@pi.net                 |_____________|||

========================== Ce .sig n'est pas une .cig
Technical Details
Message-ID: <4gtbd4$ai0@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4gsbdq$4aj@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: mcv@pi.net (Miguel Carrasquer Vidal)
Newsgroups: comp.lang.c.moderated
Subject: Re: 2-d arrays
Date: 26 Feb 1996 16:15:00 -0600
Organization: Planet Internet
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4gtbd4$ai0@solutions.solon.com>
References: <4gsbdq$4aj@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com
X-Newsreader: Forte Free Agent 1.0.82