Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #6492

Re: STRUCTURE with two dimensional array

From "Urs Eggmann" <Urs.Eggmann@shinternet.ch>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: STRUCTURE with two dimensional array
Date 2014-01-12 22:18 +0100
Message-ID <bjgf6aFmv0sU1@mid.individual.net> (permalink)
References <52ccfa58$0$9525$9b4e6d93@newsspool1.arcor-online.net>

Show all headers | View raw


Hello Fred,
First, I was not able to help you, then Jamal gave me the idea for some 
simple code.
Bound Error occurs when the code access a arrayelement outside the array.
May be it helps a bit.
regards
Urs
******************************
STRUCTURE stKart
MEMBER DIM a[20,3] AS DWORD

METHOD TestButton( ) CLASS dtaTest11
LOCAL nI , nJ , nMz AS DWORD
LOCAL stKartQ IS stKart // IS for automatic allocation of memory
nMz := 20
FOR nI:=1 UPTO nMz
   FOR nJ:=1 UPTO 3
     stKartQ.a[nI,nJ] := nJ + nI // just to make it visible
   NEXT nJ
NEXT nI
FOR nI:=1 UPTO nMz
   ? stKartQ.a[nI,1] , stKartQ.a[nI, 2] , stKartQ.a[nI,3] //
NEXT nI
RETURN NIL

/*  Output:
2 3 4
3 4 5
4 5 6
5 6 7
6 7 8
7 8 9
8 9 10
9 10 11
10 11 12
11 12 13
12 13 14
13 14 15
14 15 16
15 16 17
16 17 18
17 18 19
18 19 20
19 20 21
20 21 22
21 22 23
*/
******************************


"Fred Killet" <killet-nospam@killetsoft.de> schrieb im Newsbeitrag 
news:52ccfa58$0$9525$9b4e6d93@newsspool1.arcor-online.net...
> Hello dear VO developers,
>
> what do I wrong?
>
> LOCAL stKartQ AS stKart
> nMz := 20
> stKartQ := MemAlloc(nMz * _sizeof(stKart))
> FOR nI:=1 UPTO nMz
>  FOR nJ:=1 UPTO 3
>    stKartQ.a[nI,nJ] := REAL8(aQ[nI,nJ])
>  NEXT nJ
> NEXT nI
>
> STRUCTURE stKart
>  MEMBER DIM a[1,3] AS REAL8
>
> When reaching stKartQ[2,1] the program stops and there comes up a Message 
> "Bound Error".
> Thank you for your help!
> Kind regards Fred
> -- 
>
>
> Fred Killet
> killet-nospam@killetsoft.de
>
> ---
> Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus 
> Schutz ist aktiv.
> http://www.avast.com
> 

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

STRUCTURE with two dimensional array "Fred Killet" <killet-nospam@killetsoft.de> - 2014-01-08 08:12 +0100
  Re: STRUCTURE with two dimensional array "Jamal" <someone@example.com> - 2014-01-10 11:42 -0500
  Re: STRUCTURE with two dimensional array "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2014-01-12 22:18 +0100
    Re: STRUCTURE with two dimensional array "Fred Killet" <killet-nospam@killetsoft.de> - 2014-01-17 08:25 +0100

csiph-web