Declare a Structure Type : Definition « Structure « Visual C++ .NET






Declare a Structure Type

 

#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;

struct Author {
    char *Name;
    char *DateOfBirth;
    char *HomeTown;
};

struct Book{
    char *Title;
    char *Artist;
    Author author;
    int YearReleased;
};

int main(void)
{
   Book myBook;
   myBook.Title = "C++";
   myBook.Artist = "java2s";
   myBook.author.Name = "Jack";
   
}

   
  








Related examples in the same category

1.Create a Structure
2.Initialize a Structure
3.Access a Structure
4.Complex struct
5.struct implements IComparable