My function:
Code:
Compiler output:
I'm new to CE C, and I can't figure out what I'm doing wrong.
EDIT:
It appears that C is trying to initialize a variable array, which it is unable to do. How do I initialize a static array using a variable input?
Code:
void getNewMap(uint8_t outputArray[DUNGEON_WIDTH][DUNGEON_HEIGHT])
{
uint8_t i;
uint8_t j = 1;
for( i = 0; i < BSP_SUBDIVISIONS; i++ ) {
j = j + ipow(2, i + 1); // Separate function
};
uint8_t bspLeaves[j][4]; // Line causing issues
bspLeaves[0][0] = 0;
}
Compiler output:
Quote:
"[compiling C] src/main.c"
C:\Users\Ben\Desktop\Stuff\Programming\TI-84 Plus CE C\PDCE\src\main.c
C:\USERS\BEN\DESKTOP\STUFF\PROGRAMMING\TI-84 PLUS CE C\PDCE\SRC\MAIN.C (68,5) : ERROR (100) Syntax error
C:\USERS\BEN\DESKTOP\STUFF\PROGRAMMING\TI-84 PLUS CE C\PDCE\SRC\MAIN.C (68,16) : ERROR (128) Identifier "bspLeaves" not defined within current scope
C:\USERS\BEN\DESKTOP\STUFF\PROGRAMMING\TI-84 PLUS CE C\PDCE\SRC\MAIN.C (68,19) : ERROR (141) Object cannot be subscripted
C:\USERS\BEN\DESKTOP\STUFF\PROGRAMMING\TI-84 PLUS CE C\PDCE\SRC\MAIN.C (69,15) : ERROR (141) Object cannot be subscripted
make: *** [obj/main.src] Error -1
C:\Users\Ben\Desktop\Stuff\Programming\TI-84 Plus CE C\PDCE\src\main.c
C:\USERS\BEN\DESKTOP\STUFF\PROGRAMMING\TI-84 PLUS CE C\PDCE\SRC\MAIN.C (68,5) : ERROR (100) Syntax error
C:\USERS\BEN\DESKTOP\STUFF\PROGRAMMING\TI-84 PLUS CE C\PDCE\SRC\MAIN.C (68,16) : ERROR (128) Identifier "bspLeaves" not defined within current scope
C:\USERS\BEN\DESKTOP\STUFF\PROGRAMMING\TI-84 PLUS CE C\PDCE\SRC\MAIN.C (68,19) : ERROR (141) Object cannot be subscripted
C:\USERS\BEN\DESKTOP\STUFF\PROGRAMMING\TI-84 PLUS CE C\PDCE\SRC\MAIN.C (69,15) : ERROR (141) Object cannot be subscripted
make: *** [obj/main.src] Error -1
I'm new to CE C, and I can't figure out what I'm doing wrong.
EDIT:
It appears that C is trying to initialize a variable array, which it is unable to do. How do I initialize a static array using a variable input?