Hi,
here is the portion of code that causes the error:
Code:
how folder is initialized elsewhere in the code:
struct DIR* HOME = (struct DIR*)malloc(sizeof(struct DIR));
HOME->child = (struct DIR *)malloc( (HOME->max_children) * sizeof (struct DIR) );
void foo(char *d, struct DIR* folder)
{
struct DIR* temp_folder;
temp_folder = folder;
int i;
for(i=0;i<temp_folder->max_children;i++)
{
if(strcmp(temp_folder->child[i].name,d) == 0)
{
folder = temp_folder->child[i];
return;
}
}
my_functions.c:134: error: incompatible types in assignment
the error occurs at the line - folder = temp_folder->child[i];
For some reason it does not recognize each individual child as its own pointer.
Any suggestions?
Thanks.