tinycc/tests/tests2/36_array_initialisers.c
Arthur Williams 355897a920 Allow declared arrays to be initialized without an explicit size
When defining an array with non-explicit size, one would get
"incompatible types for redefinition of 'array' if the array was already
declared with a different size.
For example:

    extern int array[2];
    int array[] = {1};

would fail to compile with tcc. Instead the above is now equivalent to:
    int array[] = {1, 0};
2021-02-13 19:18:08 -08:00

26 lines
573 B
C

#include <stdio.h>
extern int Array3[10];
int Array3[] = { 12, 34, };
int main()
{
int Count;
int Array[10] = { 12, 34, 56, 78, 90, 123, 456, 789, 8642, 9753 };
for (Count = 0; Count < 10; Count++)
printf("%d: %d\n", Count, Array[Count]);
int Array2[10] = { 12, 34, 56, 78, 90, 123, 456, 789, 8642, 9753, };
for (Count = 0; Count < 10; Count++)
printf("%d: %d\n", Count, Array2[Count]);
for (Count = 0; Count < 10; Count++)
printf("%d: %d\n", Count, Array3[Count]);
return 0;
}
/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/