Adafruit NeoPixel library-->How to make code independent of number of LEDs

Hello,

I am using Adafruit_NeoPixel library to control Neopixel LED strip.

And I have to give the number of LEDs in strip to constructor.

But what if i have not the number of LEDs per strip.?

Can I make code which is independent of Number of LEDs?

Or if its not possible can i know the number of LEDs by software. (Reading The output from the last LED is not the option)

But what if i have not the number of LEDs per strip.?

It doesn't make a lot of sense to write software for hardware you don't have.

Can I make code which is independent of Number of LEDs?

Not using the Adafruit library. All the R data comes first, then all the G data, then all the B data. Without knowing how many Rs, you can't find the start of the Gs or Bs.