How to Create a Class , Which Size Is 0?

how to create a class , which size is 0?

If you create a class with array [0], you have done it.😄

Only in gcc compiler…in visual c++6.0, it is still 1.

1
2
3
4
5
6
7
8
9
10
11
#include<iostream>
using namespace std;
class A
{
char a[0];
};
int main()
{
cout << sizeof(A);
return 0;
}