Path: utzoo!attcan!uunet!psivax!torkil From: torkil@psivax.UUCP (Torkil Hammer) Newsgroups: comp.sys.ibm.pc.programmer Subject: Re: Bug in TC2.0 Message-ID: <3420@psivax.UUCP> Date: 5 Jun 90 14:50:56 GMT References: Distribution: comp.sys.ibm.pc.programmer Organization: Pacesetter Systems Inc., Sylmar, CA Lines: 25 In article rfrost@spam.ua.oz.au (Richard Frost) writes: # # I have found what I think is a bug in version 2.0 of the Turbo C compiler. # .. # char Test[] = {0xB0,0xB0,0xB0}; extern char *Test; # # main(int argc, char *argv[]) void testfn(void) # { { # ... ... # testfn(); # Test[1] = 'A'; # *(Test+2) = 'B'; # # } } No, not a bug in the compiler. A bug in your code, in K&R as well as ANSI standard. A pointer is not the same as an array. The code on the right could work if you declared a global pointer named Test and initialized it in the main program to point at the start of the global array Test before calling testfn. On a second thought, I think you will have to give the pointer a different name from Test, but then it should work as desired.