Create global struct - C++ Data Type

C++ examples for Data Type:struct

Description

Create global struct

Demo Code

#include <iostream>
using namespace std;
struct Date    // this is a global declaration
{
   int month;//from ww  w  .  j  ava2s .c o m
   int day;
   int year;
};
int main()
{
   Date birth;
   birth.month = 12;
   birth.day = 28;
   birth.year = 1986;
   cout << birth.month << '/' << birth.day  << '/' << birth.year << endl;
   return 0;
}

Result


Related Tutorials