N
Nikos Mitas
I have the following structure:
struct DIRECTORY{
char nameDir[40];
struct DIRECTORY *parent;
int numSubDir;
struct DIRECTORY *subDir[10];
};
when i did this
struct DIRECTORY *currentDir;
currentDir = malloc(sizeof(struct DIRECTORY) );
didn't i allocate all the linked structures?
Meaning is "currentDir->subDir[0]->nameDir" valid or not?
The problem is that when i do this:
strcpy(currentDir->subDir[0]->nameDir,newDirName);
It produces a runtime error which i can not find.No warnings,no errors
on compilation.
newDirName is a pointer with some data...
struct DIRECTORY{
char nameDir[40];
struct DIRECTORY *parent;
int numSubDir;
struct DIRECTORY *subDir[10];
};
when i did this
struct DIRECTORY *currentDir;
currentDir = malloc(sizeof(struct DIRECTORY) );
didn't i allocate all the linked structures?
Meaning is "currentDir->subDir[0]->nameDir" valid or not?
The problem is that when i do this:
strcpy(currentDir->subDir[0]->nameDir,newDirName);
It produces a runtime error which i can not find.No warnings,no errors
on compilation.
newDirName is a pointer with some data...