Edit Anything

Professional text and hex editing
with Binary Templates technology.






SweetScape Knowledgebase
KB1024: How do I define a duplicate array?

010 Editor supports the concept of a duplicate array. Basically, 010 Editor allows you to define the same variable repeatedly in a template. For example:

     int x;
     int x;
     int x;

Then the first occurrence of x can be referenced as 'x[0]' and the last as 'x[2]' (just using 'x' always refers to the last defined occurrence). This is a handy way of making arrays and is used in a number of templates. For example, the array could be printed out like this:

     Printf( "%d %d %d\n", x[0], x[1], x[2] );

This system words well for single variables, but it fails when you want to define an array of arrays:

     int y[4];
     int y[4];

The above code does not compile because it is ambiguous what y[0] refers to. The solution is to place the array inside of a struct and then the struct can be defined multiple times:

     struct MYARRAY {
        int y[4]; 
     };
 
     MYARRAY a;
     MYARRAY a;


Back to knowledgebase index
Back to main support page



Our Products


Latest News


Download
- 010 Editor
v7.0.2
is now available.

Download it now!
What's New in 7.0.2?


Newsletter
Join our newsletter to receive tips and tricks on hex editing, special offers, and news from SweetScape Software Inc.

Sign-up Now...