struct in struct c++ example
Example 1: how to put a struct in another struct C
struct B { // <-- declare before
int number;
};
struct A {
int data;
B b; // <--- declare data member of `B`
};
Example 2: what is a struct in c++
struct Person
{
char name[50];
int age;
float salary;
};
Example 3: c++ structure
struct product {
int weight;
double price;
} ;
product apple;
product banana, melon;