]> git.sur5r.net Git - cc65/blob - test/ref/cc65070303.c
remote TABs in doc/ and test/
[cc65] / test / ref / cc65070303.c
1 /*
2   !!DESCRIPTION!!
3   !!ORIGIN!!      testsuite
4   !!LICENCE!!     Public Domain
5   !!AUTHOR!!
6 */
7
8 #include <stdio.h>
9
10 typedef signed int TypA[3];
11 typedef struct TypB {
12         TypA Data[2];
13 } sTypB;
14 sTypB Bs[10];
15 TypA * APtr;
16
17 int main(int argc, char* argv[])
18 {
19         Bs[7].Data[1][2]=11;
20         APtr=&(Bs[7].Data[1]);
21         printf("Hallo Welt! %i = %i \n",Bs[7].Data[1][2], (*APtr)[2] );
22         return 0;
23 }
24
25 /*
26 ....gives
27 test.c(20): Error: Incompatible pointer types
28 for   APtr=&(Bs[7].Data[1]);
29
30 My experience in C is very limited, but as this works both in MSVC and 
31 the 8 bit Z80 compiler i originally used, i guess its an bug in CC65.
32
33 As a workaround, an typecast via  APtr=(TypA*)&(Bs[7].Data[1]);
34 seems to work.
35
36 greetings,
37    Andreas
38 */