Error: new types defined in a return type???

Hello!
Please, can someone make me clear wha tis wrong here?
Many thanks!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include<iostream>
using namespace std;

struct person{
char name[20];
char gender;
char adress[30];
int day;
int month;
int year;
}


int main(){
person friend={"Mark", 'M', "NY Street 47", 23, 7, 1979};
person* pointer=&friend;
// cout:

cout<<"Name os the person: "<<friend.name<<endl;
cout<<"Gender of the person: "<<((friend.gender=='M')?"male":"female")<<endl;
cout<<"Adressof the person: "<<friend.adress<<endl;

//cout<<"pointer is: "<<pointer<<endl;
cout<<"Name of the person is: "<<(*pointer).name<<endl;
cout<<"Name of the person: "<<pointer->name<<endl;
cout<<"Adress of the person: "<<(*pointer).adress<<endl;
cout<<"Adress of the person: "<<pointer->adress<<endl;



return 0;
}


1
2
3
4
5


	

Line 14: error: new types may not be defined in a return type
Last edited on
1
2
3
4
5
6
7
8
struct person{
char name[20];
char gender;
char adress[30];
int day;
int month;
int year;
};  // semicolon ! 


On top of that don't name your object of struct person "friend", because friend is a reserved keyword for classes (that's why it's blue)
How the hell wil lI look like with 80:bash:bash:bash!!!

MANY THANKS!!!
Topic archived. No new replies allowed.