I wrote a simple prototype code just to show the problem:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
int main(int argc, char const *argv[])
{
int rows, columns;
int arr[rows][columns];
printf("%i", arr[0][0]);
}
Compiling this code I get no errors/warnings but in my IDE (visual studio code), the variables rows
and columns
are underlined in red and upon hovering over them, I get the error/message saying expression must have a constant value
.
Is it a problem in the code or just the IDE? The code compiles and runs without any problems and runs exactly as I need it to. Any idea why this is?
Many thanks.