I have a struct as following:
extern struct team_t
{
char *name1;
char *email1;
char *name2;
char *email2;
} team;
struct team_t team =
{
"some string1",
"some string2",
"some string3",
"some string4"
};
Then in another file I create the following function that copies this struct into a new struct:
void *ucase( struct team_t *team)
{
struct team_t *ucase_team = malloc( sizeof *ucase_team);
memcpy ((char*)ucase_team, (char *)team, sizeof (ucase_team));
return NULL;
}
However, when I want to call ucase(team)
, I'm getting a segfault. I need to use void *
because this will later be used for shell signals. What am I missing?
Update: Following call gives type argument of unary ‘*’ (have ‘struct team_t’)
error:
ucase(*team)
Update 2: I have removed Null return and used ucase(team)
but still getting segfault.