Anytime Help Center

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Support
  • Guest
  • Log In
English (US)
US English (US)
DE German
CN Chinese
MX Spanish (Mexico)
Chinese (Simplified)
  • AKG
    Microphones Wireless Integrated Systems Automatic Mixers Headphones Discontinued Products (AKG) General AKG Inquiries Certifications (AKG)
  • AMX
    Networked A/V Distribution (AVoIP) Traditional A/V Distribution Video Signal Processing Architectural Connectivity User Interfaces Control Processing Power (AMX) Programming (AMX) Software (AMX) Discontinued Products (AMX) General AMX Inquiries Certifications (AMX)
  • BSS
    Soundweb™ Omni Soundweb™ London Soundweb™ Contrio™ Software (BSS) Discontinued Products (BSS) General BSS Inquiries Certifications (BSS)
  • Crown
    CDi DriveCore Series CDi Series Commercial Series ComTech Series DCi DriveCore Series I-Tech HD Series XLC series XLi Series XLS DriveCore 2 Series XTi 2 Series Discontinued Products (Crown) Software (Crown) General Crown Inquiries Certifications (Crown)
  • dbx
    CX Series 500 Series DriveRack Personal Monitor Control ZonePRO Zone Controllers FeedBack Suppression Microphone Preamps Dynamics Processors Crossovers Equalizers Software (dbx) Discontinued Products (dbx) General dbx Inquiries Certifications (dbx)
  • Flux::
    Immersive Processing Analysis Subscriptions
  • JBL
    Cinema Sound Installed Live Portable Tour Sound Recording & Broadcast Software (JBL) Discontinued Products (JBL) Video Manual Series (JBL) General JBL Inquiries Certifications (JBL)
  • Lexicon
    Plugins Effects Processors Cinema Discontinued Products (Lexicon) Video Manual Series (Lexicon) General Lexicon Inquiries Certifications (Lexicon)
  • Martin
    Atomic ELP ERA Exterior MAC P3 VC VDO Tools Discontinued Products (Martin) General Martin Inquiries Certifications (Martin)
  • Soundcraft
    Digital Analog Connected Analog Only Discontinued Products (Soundcraft) Video Manual Series (Soundcraft) General Soundcraft Inquiries Certifications (Soundcraft)
  • General HARMAN Inquiries
    Dante
+ More
  • Home
  • AMX
  • Programming (AMX)
  • Programming

Initializing Arrays of User-Defined Structures

Technical Support Guide

Written by Jose Liberio Cruz

Updated at February 9th, 2026

Initializing Arrays of User-Defined Structures​

Symptoms

If you try to initialize an array of a user-defined data type in the DEFINE_CONSTANT or DEFINE_VARIABLE sections of your NetLinx code, you may get the compile error “Too many elements in initializer" or other errors.

Even if you do not get compile errors when you run the code you find the structure array contains no data.

Cause

Initializing an array of a user-defined data type in DEFINE_CONSTANT or DEFINE_VARIABLE is not supported at this time.

Only arrays of the pre-defined data types such as DEV, DEVCHAN, etc. can be initialized in these sections.

Resolution

Instead initialize the structure array in DEFINE_START, for example:

DEFINE_TYPE

STRUCT innerStruct

{

INTEGER most

INTEGER secret

}

STRUCT someStruct

{

CHAR str[2][32]

INTEGER num

DEV dv

innerStruct inner

}

DEFINE_VARIABLE

someStruct struct1 = {{'Eleanor','Rigby'}, 1, 33001:1:0,{11,12}}

someStruct struct2 = {{'Colonel','Mustard'},2,33002:1:0,{21,22}}

someStruct struct3 = {{'MC','Hammer'},3,33003:1:0,{31,32}}

someStruct structArray[3]

DEFINE_START

structArray[1] = struct1

structArray[2] = struct2

structArray[3] = struct3

 

In this first example you end up declaring two structures instead of one for each array element to be initialized, but the syntax is more concise than if you         set each structure member individually in DEFINE_START (as below) so the memory usage is not increased as much as you might think.

However, if your structure contains arrays of another structure, even of the pre-defined data types, you must type it all out longhand in DEFINE_START:

 

DEFINE_TYPE

STRUCT innerStruct

{

INTEGER most

INTEGER secret

}

STRUCT someStruct

{

CHAR str[2][32]

INTEGER num

DEV dv[2]

innerStruct inner

}

DEFINE_VARIABLE

someStruct structArray[3]

DEFINE_START

structArray[1].str[1] = 'Eleanor'

structArray[1].str[2] = 'Rigby'

structArray[1].num = 1

structArray[1].dv[1] = 33001:1:0

structArray[1].dv [2] = 33001:2:0

structArray[1].inner.most = 11

structArray[1].inner.secret = 12

// etc…​

Related Videos

struct arrays data initialization

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • AMX SPLIT_STRING
  • Hex String to IP device in Muse Automator

Related Articles

  • AMX SPLIT_STRING
  • Hex String to IP device in Muse Automator
Copyright © HARMAN Professional. All rights reserved. Privacy Policy | Terms of Use
Expand