1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
struct foo {int x; float y;};
union bar {int x; float y;};
main (){
static char *s0 = "this string";
static char s1[19] = "Not null terminated";
static char s2[16] = "Null terminated";
static char s3[16] = "N";
char *s4 = "this string";
char s5[19] = "Not null terminated";
char s6[16] = "Null terminated";
/* something weird happens here
char s7[] = "Also null terminated";
*/
/* should also work
static int a1[] = {0,1,2,3,4};
*/
static int a1[5] = {0,1,2,3,4};
/* This is incorrect */
static int a2[5];
int a3[5] = {0,1,2,3,4};
int a4[5] = {0,1,2};
static struct foo st1 = {1,2.0};
static struct foo st2;
struct foo st3 = {3,4.0};
static union bar u1; /* 1st component should be statically set to 0 */
static union bar u2 = {3}; /* 1st component should be statically set to 3 */
union bar u3; /* no initialization */
union bar u4 = {4}; /* 1st component should be dynamically set to 4 */
static struct foo ast1[3] = {{1,1.0},{2,2.0},{3,3.0}};
static struct foo ast2[3] = {1,1.0,2,2.0,3,3.0,};
static struct foo ast3[3] = {1,1.0,2,2.0,{3,3.0,}};
static struct foo ast4[3] = {1,1.0,2,2.0,{3,}};
static struct foo ast5[3] = {1,1.0,2,{3,}};
char z[][3] = {"abc","def"};
return 0;
}
|