Hi I copied the following code from my linux machine with clion running. But in VS on Windows it seems to cause problems
entry_t* find_entry( char* n )
{
// TODO (2)
int x = strlen(n);
char str[x];
for (size_t i = 0; i < strlen(str); i++)
{
str[i] = toupper(n[i]);
}
n = &str;
for (size_t i = 0; i < list_length; i++)
{
if (strcmp(n, name_list[i].name) == 0)
{
return &name_list[i];
}
}
}
VS underlines the x in char str[x];
before the statement do find x was in the brackets of str. I thought finding the length first in another variable would solve the problem
VS give the following error
Schweregrad Code Beschreibung Projekt Datei Zeile Unterdrückungszustand Fehler (aktiv) E0028 Der Ausdruck muss einen Konstantenwert aufweisen. Names.exe - x64-Debug C:\Users\Eyüp\source\repos\09\main.c 102
trying my best to translate it -> Error(active) E0028 Statement needs to be a constant value