Skip to main content
deleted 43 characters in body
Source Link
jami
  • 111
  • 2

The error message is correct. You did not define the size of the array. You have 3 choices:

  1. Declare it with a constant length

    int foo[10];

  2. Declare it and initalize it

    int foo[] = {0,1,2,3,4,5,6,7,8,9};

  3. Declare it dynamic as pointer and alloc or realloc the mem by yourself (this is not recommended (realloc) because of possible heap memory fragmentation)

    int foo; int size = 10; foo = (int)malloc(foo, sizesize * sizeof(int)); // don't forget to free the reserved space laterfree(foo);

As reference: http://www.arduino.cc/en/pmwiki.php?n=Reference/Array

The error message is correct. You did not define the size of the array. You have 3 choices:

  1. Declare it with a constant length

    int foo[10];

  2. Declare it and initalize it

    int foo[] = {0,1,2,3,4,5,6,7,8,9};

  3. Declare it dynamic as pointer and alloc or realloc the mem by yourself (this is not recommended (realloc) because of possible heap memory fragmentation)

    int foo; int size = 10; foo = (int)malloc(foo, size * sizeof(int)); // don't forget to free the reserved space later

As reference: http://www.arduino.cc/en/pmwiki.php?n=Reference/Array

The error message is correct. You did not define the size of the array. You have 3 choices:

  1. Declare it with a constant length

    int foo[10];

  2. Declare it and initalize it

    int foo[] = {0,1,2,3,4,5,6,7,8,9};

  3. Declare it dynamic as pointer and alloc or realloc the mem by yourself (this is not recommended (realloc) because of possible heap memory fragmentation)

    int foo; int size = 10; foo = (int)malloc(size * sizeof(int)); free(foo);

As reference: http://www.arduino.cc/en/pmwiki.php?n=Reference/Array

Source Link
jami
  • 111
  • 2

The error message is correct. You did not define the size of the array. You have 3 choices:

  1. Declare it with a constant length

    int foo[10];

  2. Declare it and initalize it

    int foo[] = {0,1,2,3,4,5,6,7,8,9};

  3. Declare it dynamic as pointer and alloc or realloc the mem by yourself (this is not recommended (realloc) because of possible heap memory fragmentation)

    int foo; int size = 10; foo = (int)malloc(foo, size * sizeof(int)); // don't forget to free the reserved space later

As reference: http://www.arduino.cc/en/pmwiki.php?n=Reference/Array