Use strcpy to copy a string. You've got more going wrong in that code, though. I think you're after something that might look a bit like this:
#include <string.h>
typedef struct
{
int age;
char name[50];
} Person;
Person newperson(char *name, int age)
{
Person temp;
strcpy(temp.name, name);
temp.age = age;
return temp;
}
Reputation Points: 2780
Solved Threads: 312
long time no c
Offline 4,790 posts
since Apr 2004