Array: Difference between revisions

Content added Content deleted
(Move examples to new draft task, letter frequency.)
(Restore Pascal code; it never computes letter frequency.)
Line 35: Line 35:
==Examples==
==Examples==
* [[letter frequency]]
* [[letter frequency]]

===[[Pascal]]===
This defines an array suitable to hold a 64x64 truecolor image (i.e. red, green and blue RGB values all can go from 0 to 255) and then sets the color of a single pixel
<lang pascal>
type
color = red, green, blue;
rgbvalue = 0 .. 255;

var
picture: array[0 .. 63, 0 .. 63, color] of rgbvalue

begin
{ set pixel (4,7) to yellow }
picture[4, 7, red] := 255;
picture[4, 7, green] := 255;
picture[4, 7, blue] := 0
end.
</lang>


[[Category:Data Structures]]
[[Category:Data Structures]]