Code help! - eviltoast

<!-- SC_OFF --><div class=“md”><p>Hi</p> <p>I am trying to use a palette mixer, by creating an array and passing it to a palmixer that takes two palettes (current and next) and slowly blends a transition from the first to the last.</p> <p>I am doing it using a for loop, and i want to limit the last member of the loop to the size of the array.</p> <p>I am doing the following:</p> <p>enum PalChoice { kClouds = 0, kRainbow, ... kMango, kSprinkles, kNumPalettes };</p> <p>// An array of palette pointers so we can randomly choose one CRGBPalette16 palettes[kNumPalettes];</p> <p>When I pass the palettes array to my class constructor, I want to create a const with the number of members of that array. I tried doing the following:</p> <p><code> Palmixer::Palmixer( CRGBPalette16* palettes, CRGBPalette256* currentPalette, CRGBPalette256* nextPalette, CRGBPalette256* finalPalette) { _palettes = palettes; _currentPalette = currentPalette; _nextPalette = nextPalette; _finalPalette = finalPalette; _kNumPalettes = *(&_palettes + 1) - _palettes; } </code></p> <p>But the number is not correct.</p> <p>Any help is appreciated.</p> </div><!-- SC_ON --> submitted by <a href=“https://old.reddit.com/user/jcliment”> /u/jcliment </a> <br/> <span><a href=“https://old.reddit.com/r/FastLED/comments/15c5l47/code_help/”>[link]</a></span> <span><a href=“https://old.reddit.com/r/FastLED/comments/15c5l47/code_help/”>[comments]</a></span>