Question:
in turbo pascal i have an error like this "ERROR 96: To many variables" what's the problem? and what can i do?
Ali Jahan
2011-02-04 01:26:30 UTC
i declared a type like this:
type
color:array[1..160,1..120] of byte;

when i use this type in my program named error appears
what can i do?
help me plz!
Three answers:
mystic smeg
2011-02-04 02:41:59 UTC
Hi there,



The error is caused by Pascal running under DOS.



DOS uses old memory conventions, in as much as you have limited resources, in only 64k addressable memory blocks/ 16k chunks. When you define large arrays or too many variables that go over the Stack/Heap space limits, you will be unable to compile code and will get the error you describe.



The answer is to do one of the following:

1. reduce the amount of variables.

2. adjust the heap/stack space using the {$M stack,heap} or {$MEM xyz} compiler directives.

3. adjust where variables are stored (see "absolute")

4. Use a different (32bit) compiler.



I found the following code works just fine:

---- listing ----

program Test;



uses crt;



type

TColor = Array[1..160,1..120] of byte;



var

Colors: TColor;

x,y: byte;



begin

for y:=Low(Colors) to High(Colors) do

for x:=Low(Colors[y]) to High(Colors[y]) do

Colors[x,y]:=0;

end.



I hope this helps, but feel free to mail me (mystic.smeg@yahoo.co.uk) should you need further help.



na
montfort
2016-12-16 12:01:09 UTC
Error 96
purushotham
2011-02-04 01:38:19 UTC
I suggest you ask this in a Turbo Pascal related forum or newsgroup. Or you can switch to FPC and not have this problem.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...