Now I am having the following issue:
error: incompatible types in assignment
my file1.c looks like this:
Code:
#include <stdio.h>
#include "file2.h"
int main() {
struct my_struct new_struct;
new_struct = create_my_struct();
printf("%s %s", new_struct.first_name, new_struct.last_name);
return 0;
}
and, my file2.c looks like this
Code:
#include <string.h>
struct my_struct create_my_struct() {
struct my_struct ms;
strcpy(ms.first_name, "john");
strcpy(ms.last_name, "smith");
return ms;
};
The issue relates to line6 in file1.c (new_struct = create_my_struct();). These both seem to be of the same type (file1 declares a variable of type my_struct, and file2 returns a variable of type my_struct). Any idea what the issue might be?