nested structure

I have studied structures and a little confused about nested structure.
I will be very thankful ,If anyone fix this program and give me more examples of nested structures .

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


struct masih {
  string title;
  int year;
};

struct tukhi {
  string name;
  string email;
  masih favorite_movie;
  } charlie, maria;

tukhi * pfriends;
 *pfriends= &charlie;
 int main()
 {

charlie.favorite_movie.year=7;
cout <<charlie.favorite_movie.year;
return 0;
 }
Last edited on
pfriends is global variable.
Just move line 17 into main().
Topic archived. No new replies allowed.