create a struct object c++ code example
Example 1: how to initialize an struct object in c++
// exemple avec la structure Coordonnees :
struct Coordonnees
{
int x;
int y;
}
int main()
{
Coordonnees coords = {1,2};
}
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;