cpp empty array declaration
<p>Hello I have the following test code and I am confused about cpp.
1) If you declare in library.h an array with an empty element clause .. what will the compiler pick ? It does also not complain, I use Cygwin.
2) In library.cpp I assign values to two elements, is the compiler assuming an array with one element and I write the second element outside the scope of the array?</p>

<p>Many thanks in advance.</p>

<h1>cat library.h</h1>

<pre><code>#ifndef LIBRARY_H
#define LIBRARY_H

class library {

   public:
     void print();
     char a[];
};


#endif
</code></pre>

<h1>cat library.cpp</h1>

<pre><code>#include&lt;stdio.h&gt;
#include"library.h"

void library::print() {
        a[0]='a';
        printf("1. element: %d\n", a[0]);
        a[1]='b';
        printf("2. element: %d\n", a[1]);
}
</code></pre>

<h1>cat client.cpp</h1>

<pre><code>#include&lt;stdio.h&gt;
#include"library.h"

void execute();
library l;

int main() {
        l = library();
        l.print();
        return 0;
}
</code></pre>

<h1>cat Makefile</h1>

<pre><code>OPTIONS=-Wall

all: main

run: main
        ./main.exe

main: client.o library.o
        g++ $(OPTIONS) -o main $^

library.o: library.cpp library.h
        g++ $(OPTIONS) -c $&lt;

.cpp.o:
        g++ $(OPTIONS) -c $&lt;

clean:
        rm -r *.o
</code></pre>
