Article View: comp.windows.misc
Article #440Re: problems with a[i][j] within a function
From: MORAGA ORELLANA, CORNELIO
Date: Wed, 11 Nov 1992 17:28
Date: Wed, 11 Nov 1992 17:28
27 lines
1354 bytes
1354 bytes
> I am a complete novice to X-windows programming (although I know
>C and unix and VMS systems programming at an intermediate level). I
>need to take a 2-dimensional array of colormap indeces, corresponding
>to a rectangular patch of the screen with pixels of different colors,
>and throw it up as a window on a Ultrix VAX or a VMS Vax with
>DecWindows (no MIT X stuff - just regular out-of-the-box DecWindows)
>from a C program. Something like this:
>display_in_window(array)
(array, dim1, dim2)
function display_in_windows can't know dim1 and dim2
if not it specified.
>short array[X][Y];
>{
> /* here's the part I'm having trouble with */
a_ij = array[i][j]; ==> error !!!
it's better to use (though more complex)
a_ij = ((short*)array)[i*dim2+j]; /* this is correct ! */
>}
>
[ ... ]
>Mike Levin
>
cmoraga@dcc.uchile.cl
>
Technical Details
Message-ID:
<1992Nov11.172847.13525@dcc.uchile.cl>Path:
arc1-ca.pugleaf.net!sparky!uunet!uchdcc!dcc.uchile.cl!cmoragaShow Full Headers
Complete Article Headers
Newsgroups: comp.windows.misc Path: arc1-ca.pugleaf.net!sparky!uunet!uchdcc!dcc.uchile.cl!cmoraga From: cmoraga@dcc.uchile.cl (MORAGA ORELLANA, CORNELIO) Subject: Re: problems with a[i][j] within a function Originator: cmoraga@dcc.uchile.cl Sender: usenet@dcc.uchile.cl (Network News) Message-ID: <1992Nov11.172847.13525@dcc.uchile.cl> Date: Wed, 11 Nov 1992 17:28:47 GMT Organization: Universidad de Chile, Depto. de Ciencias de la Computacion Lines: 28