I'm writing a code that bring the values from a structure called "data", captures it in the main() function and then use the value inside "my_friend.friend_age" as a parameter in the function sum() to sum 20 to the value inside "my_friend.friend_age" and, afterward, return the value and show it to the user. `
#include <stdio.h>
int sum(struct data age);
struct data{
char name_friend[50];
int friend_age;
};
struct data my_friend;
int main(){
int d;
printf("Type your friends name: ");
scanf("%s", &my_friend.name_friend);
printf("Type your friends age: ");
scanf("%d", &my_friend.friend_age);
d= sum(my_friend.friend_age);
printf("%d", d);
}
int sum(struct my_friend age)
{
int agein_20;
agein_20= agein_20 + age;
return agein_20;
}
`
However, at the time of compile it and run it I'm getting errors such as:
I'd really appreciate your help because I'm not sure about what I'm doing wrong ;)