🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.pascal
Article #80355

Re: dynamiczna tablica (jeszcze raz)

#80355
From: Maly
Date: Mon, 20 Oct 2003 18:51
35 lines
1804 bytes
Solaris wrote:
> Probowalem cos takiego (fpc):
>
> type Tcos = array [0..MaxLongint] of byte;
>        Pcos = ^Tcos;
>
> var el : cardinal;
>       cos : Pcos;
>
> begin
> el := 100;
> getmem(level,el * Sizeof(cardinal));

SizeOf(byte) jak chcesz tablice bajtów :>.
masz array[] of byte to licz ilośc zajmowanej pamięci na bajtach
a nie cardinal'ach, oczywiste chyba :>.

> cos^[150]:=1; // *
> writeln(cos^[150]);  //  i to pokazuje mi wartosc 1 a powinno np.0,
>                                 //zadeklarowalem tylko 100 elementow.

zadeklarowałeś 100 cardinal'ów a wiec 400 bajtów :> zreszta
jak byś tam siegał swiadomie w 150 bajt dla zaallokowanych 100
to byś dostał qlturalny 216/AV/GPF*

* - niepotrzebne skreślić :>

> freemem(level,el * Sizeof(cardinal));
> end.
>
> Co jest zle ?

-- 
Pozdrawiam,
Maly.
Technical Details
Message-ID: <bn1aq8$2p8$1@absinth.dialog.net.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!newsfeed.gazeta.pl!news.dialog.net.pl!not-for-mail
References: <bn19lb$1l7$1@nemesis.news.tpi.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!newsfeed.gazeta.pl!news.dialog.net.pl!not-for-mail
From: "Maly" <maly@USUNnan.pl>
Newsgroups: pl.comp.lang.pascal
Subject: Re: dynamiczna tablica (jeszcze raz)
Date: Mon, 20 Oct 2003 20:51:47 +0200
Organization: Dialog Net
Lines: 36
Message-ID: <bn1aq8$2p8$1@absinth.dialog.net.pl>
References: <bn19lb$1l7$1@nemesis.news.tpi.pl>
NNTP-Posting-Host: dial-1946.zgora.dialog.net.pl
Mime-Version: 1.0
X-Trace: absinth.dialog.net.pl 1066675848 2856 62.87.224.154 (20 Oct 2003 18:50:48 GMT)
X-Complaints-To: http://www.dialog.pl/dialog/internet/internet.php?id=41
NNTP-Posting-Date: Mon, 20 Oct 2003 18:50:48 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit