I can't post my actual code because this is for a homework assignment and I don't want to risk cheating, I can give an example of my issue though. For example this is a version of what I'm trying to do, creating an array with a parameter.
void func(int length)
{
int array[length] = {0};
}
This is oversimplified but it is stating that I can't do this and I receive this error:
Problem-01FAILED.c:48:16: error: variable-sized object may not be initialized int tempArray[t][2] = {}; ^ 1 error generated.
It also stated that I can't do the below, assign the value of the parameter to a variable and create an array within the function using that. It gives the same error.
void func(int length)
{
int t = length;
int array[t] = {0};
}
If anyone can tell me why this is happening and how to fix it, I would greatly appreciate it.