Announcement

Collapse
No announcement yet.

Array defined in a TYPE?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Array defined in a TYPE?

    Given:
    Code:
    TYPE SCPReplySrMpg DWORD FILL
     number AS WORD
     mask_count AS WORD
     num_active AS WORD
     active_mp_list(0 TO 256) AS WORD   '// list of the active point pairs (Type-Num) (MAX_MP_PER_MPG)
    END TYPE
    Do I need to DIM the array prior to use? Can I define the array inside the TYPE or should it be defined outside and then referenced in the TYPE?


    This is what it looks like in C

    Code:
    typedef struct tagReplySrMpg
     { short number;                         // MP number
       short mask_count;                     // mask count
       short num_active;                     // number of active MPs
       short active_mp_list[MAX_MPPERMPG*2]; // list of the active point pairs (Type-Num) (MAX_MP_PER_MPG=128)
    }ReplySrMpg;
    Last edited by David Clarke; 25 Mar 2020, 09:17 PM.

  • #2
    I am thinking you do have to DIM it in PB Main (or somewhere else)

    Comment


    • #3
      > Do I need to DIM the array prior to use?

      No.

      > Can I define the array inside the TYPE

      Yes.

      > or should it be defined outside and then referenced in the TYPE?

      No

      > I am thinking you do have to DIM it in PB Main (or somewhere else)

      Wrong.

      BTW active_mp_list(0 TO 256) must be active_mp_list(0 TO 255)
      Forum: http://www.jose.it-berater.org/smfforum/index.php

      Comment


      • #4
        Do I need to DIM the array prior to use?
        The subscript(s) you put in TYPE / END TYPE is/are the DIM.
        Can I define the array inside the TYPE or …
        You must define it/them inside the TYPE / END TYPE.
        The "active_mp_list" line in your post is correct.

        Cheers,
        Dale

        Comment


        • #5
          Thanks guys!!

          Comment

          Working...
          X