Register | Login
Forum Index > Samples > Open Array
Author Message
Pages: 1
Site Admin


(send private message)

Posts: 925
Topics: 54

OverHertz Studio
[1339] Open Array - posted: 2013-02-18 04:21:29
Version now has better support for arrays and initialized data, so let us take a look at creating an open array in ziron.

program WIN32CUI 'sample';

#include 'ch.zir';

//declare a small block so we can have short strings in our array
block ShortString {
  char text[32];

now we can declare our array several different ways

// here we can see the array can hold upto 6 different strings, but we only use 4 of them
ShortString value[6] = ['ziron', ' is my ', 'fav ', 'language!!!'];


// here we let ziron count the array items at compile time. 
ShortString value[] = ['ziron', ' is my ', 'fav ', 'language!!!'];
// you may also disregard the [] after value.

and finally we will print our array, so we will end our sample with:

print(@value[0], @value[1], @value[2], @value[3], '\r\n');


Some other things to note, i have tried to make ziron to be as lenient as possible so it is possible to assign different values in different ways to global variales. I will write a few examples using the same variable name for reference:

Int32 arr[4]; //all array items are null

Int32 arr[4] = 512; //first array entry is 512

Int32 arr[4] = [512, 1024, 2048]; //1-3 array items filled in last is null

Int32 arr[] = [512]; //array length 1, size 4 bytes

Int32 arr = [512, 1024]; //array length 2, size 8

I hope this helps, if you need more help just let me know smile

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1
create new reply

Quick reply:


Currently Active Users:
There are currently 1 user(s) online. 0 member(s) and 1 guest(s)
Most users ever online was 533, May 5, 2016, 7:19 am.

Threads: 223 | Posts: 1837 | Members: 51 | Active Members: 51
Welcome to our newest member, HarryJenkins
const Copyright = '2011-2018 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd