Variable Length Array

Status
Not open for further replies.

btmcmahan

Well-known member
I want to define an Array length in my main sketch, but I want to take that definition and create the array of that length in my H file. Is this possible?

example:

Code:
//Main Sketch

#define dataLength 20

//...more stuff

then...
Code:
#ifndef myheader_h
#define _myheader_h

#include "mk20dx128.h"
#include "core_pins.h"

int data[dataLength] = {};

//...more stuff

of corse, it won't let me do it like that or I wouldn't be asking...

error: 'dataLength' was not declared in this scope
 
Last edited:
Status
Not open for further replies.
Back
Top