Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3341830
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:46:04+00:00 2026-05-18T00:46:04+00:00

I have a three dimensional static const array that is acting as a lookup

  • 0

I have a three dimensional static const array that is acting as a lookup table. Each cell of the array can return up to 8 separate numbers (each number is the corner of a cube – a voxel to be exact). So for example, MyStaticArray[0][1][1] might return 1,2,5,7. It can return a single number or a maximum of eight numbers, like so: 1,2,3,4,5,6,7,8.

I already have the lookup table prepared (on paper), my question is what the best way to store it? Initially I was going with a static const unsigned char[][][] but that is obviously not going to work in this case as the table can return more than one number (again, from 1-8).

My next solution was to return an unsigned char array. That is, static const unsigned char* [][][]. How do I initialize this (that is, how do I initialize the static const array to return to me unsigned char arrays that are also static so that I can access them without initializing a class)? Is there a better way?

I hope I was able to explain the question properly. If not, let me know and I will try to reword it and/or provide extra info.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T00:46:05+00:00Added an answer on May 18, 2026 at 12:46 am

    You could pad each element up to the maximum length with dummy elements, and go with a 4D array:

    static const unsigned char x[M][N][P][8] = { { 1, 2, 5, 7, -1, -1, -1, -1 },
                                                 { 1, 2, 3, 4,  5,  6,  7,  8 },
                                                 ...
    

    or you could use individual bits as flags, e.g.:

    static const unsigned char x[M][N][P] = { 0x53, // Bits 0, 1, 4, 6 are set
                                              0xFF,
                                              ...
    

    If you find yourself needing more than 8 possibilities, upgrade to e.g. uint16_t or uint32_t.

    Which method you go with depends on what you intend to do with the data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two vectors defining two separate points in a three-dimensional space. One is
I need to compare a 1-dimensional array, in that I need to compare each
I have three unordered lists that have been created as Scriptaculous Sortables so that
I have three tables in the many-to-many format. I.e, table A, B, and AB
I have three values I need to align in a dropdown box. How can
Okay, I have a multi-dimensional array which is statically-allocated. I'd very much like to
I have three known 3-Dimensional points: A , B , and C . Addtionally,
I have some data that goes over three levels, like this: Identifier, Key, Value
Is there an easy way to get an two-dimensional array or something similar that
I have a script that appends some rows to a table. One of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.