I've got a problem when i'm programming.
struct skills {
int SnCrypt;
char* Soutput;
int Soptind;
int Sdecrypt;
int Sargc;
char* Spassword;
char *const Sargv[];
};
struct skills* initSkills(int nCrypt, char* password, char *const argv[], char* output, int optind, int decrypt, int argc) {
struct skills* skill;
skill->SnCrypt = nCrypt;
skill->Spassword = password;
skill->Sargv = argv;
skill->Soutput = output;
skill->Soptind = optind;
skill->Sdecrypt = decrypt;
skill->Sargc = argc;
return skill;
}
And gcc tell me
invalid use of flexible array member
for the line skill->Sargv = argv;
.
I don't understand how could I point the value pointed by char *const argv[]
by an other pointer? I'm aware that I surely must malloc
the skill->Sargv
pointer but how? Like this (char const*)malloc(sizeof(argv[]))
?