Article View: comp.lang.c.moderated
Article #2116Re: 2-d arrays
From: Konrad Schwarz
Date: Thu, 29 Feb 1996 14:39
Date: Thu, 29 Feb 1996 14:39
19 lines
976 bytes
976 bytes
In article dredlich@gulf.csc.UVic.CA (Devin Redlich) writes:
|> 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?
I don't know. One way is to use loops to go through the arrays, copying
elementwise (you only need one loop);
another is to use the standard library function memcpy (or, in
certain cases, memmove).
The following approach lets the compiler decide:
struct matrix {
type x [4][4];
} x, y;
x = y;
Konrad Schwarz
Technical Details
Message-ID:
<4h4dqo$8or@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<4gsbdq$4aj@solutions.solon.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: schwarz@a3.complang.tuwien.ac.at (Konrad Schwarz) Newsgroups: comp.lang.c.moderated Subject: Re: 2-d arrays Date: 29 Feb 1996 08:39:20 -0600 Organization: TU Wien Sender: clc@solutions.solon.com Approved: clc@solutions.solon.com Message-ID: <4h4dqo$8or@solutions.solon.com> References: <4gsbdq$4aj@solutions.solon.com> NNTP-Posting-Host: solutions.solon.com