Combining an array and type

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Seb McClouth

Combining an array and type

Post by Seb McClouth »

I was wondering sumfin. If it would be possible to do the following:

Code: Select all

TYPE PARAM
     POS as integer
     MODE as integer
     LINES as integer
END TYPE

DIM SHARED PARAME(50) as PARAM

PARAME(1).POS = 1
PARAME(2).POS = 4
I don't have QB at hand so... if you plz...

grtz
Seb
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

Yes.

Also, array index start at 0, learn to use it.
I have left this dump.
Seb McClouth

Post by Seb McClouth »

Alrighties... I know it starts at 0 but it's so much easier to use 1 to 50 then 0 to 49, I just hate (read: dislike) the fact using the line command in whatever screen mode you have to say line (0,0)-(639,479) instead of Line (1,1)-(640,480), if you get what I mean.

But anywayz, thx!!!

Grtz
Seb
User avatar
Deleter
Veteran
Posts: 119
Joined: Sat May 07, 2005 7:31 pm

Post by Deleter »

well, then you can define it like this and not waste memory:
Dim Shared Parame(1 to 50) as PARAM
that way it starts at one and contains 50 elements
Seb McClouth

Post by Seb McClouth »

Okay good one. Hehehe, and I just changed my weekdays(7) to weekdays(6) in my qbinux-source. But thanks for the hint!!
Post Reply