Additional what @k5054 suggested correctly you need to adjust
void register_user
void register_user(User *user) {
int i, age;
char username[30];
printf("\nUsername: ");
scanf("%s", username);
printf("Age : ");
scanf("%d", &age);
strcpy(user->username , username);
user->age = age;
printf("\nRegistration complete\n");
}
And call it then this way in the main loop
register_user(&user);