I am assuming that you are using a C99 compiler (with support for dynamically sized arrays). The problem in your code is that at the time when the compilers sees your variable declaration it cannot know how many elements there are in the array (I am also assuming here, from the compiler error that length
is not a compile time constant).
You must manually initialize that array:
int boardAux[length][length]; memset( boardAux, 0, length*length*sizeof(int) );
Related Posts:
- What does “collect2: error: ld returned 1 exit status” mean?
- What does “collect2: error: ld returned 1 exit status” mean?
- dereferencing pointer to incomplete type
- What does “collect2: error: ld returned 1 exit status” mean?
- C programming, error: called object is not a function or function pointer
- C compile error: Id returned 1 exit status
- (.text+0x20): undefined reference to `main’ and undefined reference to function
- what is Segmentation fault (core dumped)? [duplicate]
- What causes a segmentation fault (core dump) to occur in C?
- uint8_t vs unsigned char
- How to use symbols of extended ASCII table in C?
- What is the difference between ++i and i++?
- Using boolean values in C
- How to convert an int to string in C?
- typedef struct vs struct definitions [duplicate]
- How to print in C
- What can be the reasons of connection refused errors?
- typedef struct vs struct definitions [duplicate]
- Cannot figure out how to use getchar(); in C
- Why am I getting “void value not ignored as it ought to be”?
- 1 = false and 0 = true?
- c stack smashing detected
- char *array and char array[]
- Convert char to int in C and C++
- Get a substring of a char*
- What causes the Broken Pipe Error?
- Strings and character with printf
- Why does the terminal show “^[[A” “^[[B” “^[[C” “^[[D” when pressing the arrow keys in Ubuntu?
- Why is the gets function so dangerous that it should not be used?
- Write to .txt file?
- Warning comparison between pointer and integer
- What does #pragma once mean in C? [duplicate]
- Using ssize_t vs int
- Why a warning of “control reaches end of non-void function” for the main function?
- Connect: Socket operation on non-socket
- “Initializer element is not constant” in C
- How do you do exponentiation in C?
- Printing long int value in C
- Undefined reference to pow( ) in C, despite including math.h [duplicate]
- munmap_chunk(): invalid pointer
- C read file line by line
- No Symbol Table using GDB on Compiled Programs
- Try catch statements in C
- What is char ** in C?
- How do I create an array of strings in C?
- How to check if a string is a number?
- What is a bus error? Is it different from a segmentation fault?
- Get the current time in C
- error: expected primary-expression before ‘)’ token (C)
- where does stdio.o live in linux machine?
- Get text from user input using C
- Using Dynamic Memory allocation for arrays
- How to trigger SIGUSR1 and SIGUSR2?
- How do I lowercase a string in C?
- warning: expression result unused
- conflicting types error when compiling c program using gcc
- Get the current time in C
- error: indirection requires pointer operand (‘int’ invalid)
- What is a file with extension .a?
- What is the difference between exit(0) and exit(1) in C?
- error: indirection requires pointer operand (‘int’ invalid)
- Finding the length of a Character Array in C
- Return char[]/string from a function
- Valgrind: Invalid read of size 1
- How to print a char array in C through printf?
- How to clear all the elements of array in C?
- Zero an array in C code
- Excess elements in char array initializer error
- Encrypt with private key and decrypt with public key
- strcmp giving segmentation fault
- What does “pointer being freed was not allocated” mean exactly?
- strcmp not working
- How to use timer in C?
- C char* to int conversion
- What is the difference between stdin and STDIN_FILENO?
- Allocating string with malloc
- How to simply convert a float to a string in c?
- What is the difference between char array and char pointer in C?
- hash function for string
- What happens during a “relocation has invalid symbol index” error?
- What are .axf files?
- Error: “Access not within mapped region at address” (Valgrind)
- printf format specifiers for uint32_t and size_t
- How to convert string to float?
- What is an simple example of copy_from_user
- What is `S_ISREG()`, and what does it do?
- typedef struct pointer definition
- How does the fscanf function work?
- Math constant PI value in C
- Return a `struct` from a function in C
- C: scanf to array
- The code does not execute properly. Try to figure out why
- What are “prototypes” in a C program?
- ld.exe: cannot open output file … : Permission denied
- How to read from input until newline is found using scanf()?
- getline() vs. fgets(): Control memory allocation
- What is char ** in C? [duplicate]
- segmentation fault using scanf
- Segmentation fault- strcat
- segmentation fault with strcpy [duplicate]