// Win32ConsoleMemoryTest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
struct B
{
int j;
};
struct A
{
int i;
B b[0];
};
template<int a> class BT
{
public:
BT()
:size(a)
{
}
int size;
};
int _tmain(int argc, _TCHAR* argv[])
{
const int i = sizeof(B);
BT<i> bt;
cout<<bt.size<<endl;
A a;
a.i = 1;
B b1;
b1.j = 2;
B b2;
b2.j = 3;
A* pA = (A*)(malloc(sizeof(A) + 2*sizeof(B)));
memcpy((char*)pA + sizeof(A) ,&b1,sizeof(B));
memcpy((char*)pA + sizeof(A) + sizeof(B),&b2,sizeof(B));
cout<<(pA->b[0].j)<<endl;
cout<<(pA->b[1].j)<<endl;
cin.get();
}