From: Eric Backus Subject: Re: STRCMP (again) To: mpsears AT newton DOT cs DOT sandia DOT gov Date: Thu, 11 Mar 93 11:05:22 PST Cc: ckgp!thomas AT uunet DOT uu DOT net, djgpp AT sun DOT soe DOT clarkson DOT edu Mailer: Elm [revision: 66.25] Michael Thomas's test program is: > #include > #include > #include > > main() > { > char line[2][81]; > int stat=0; > > printf("\nline 1: "); > gets(line[0]); > printf("\nline 2: "); > gets(line[1]); > stat = strcmp(line[0],line[1]); > printf("\nresult: %d",stat); > exit(0); > } There is nothing wrong with this test program (well, actually lint would complain that the return type of "main" is not specified and defaults to int, but who cares). If you are indeed getting bogus results from this program, something major is wrong. You could try a compile with -v and make sure that all of the paths to the preprocessor, linker, and libraries are correct. You could try looking at the preprocessor output (with gcc -E) and make sure the include files look line the correct ones, and that there is a correct prototype for strcmp() in there somewhere. You could try typing "go32" and see what version number is printed. Strange things can happen if you mix different parts of different versions of djgpp. mark sears writes: > I dont think your problem is related to strcmp. > > I think you really wanted to declare line as > > char line[81][2]; Not true. The program as originally written is correct, and allows the input lines to be up to 80 characters long. Your "char line[81][2]" would declare line as an array of 81 two-character arrays. -- Eric Backus ericb AT lsid DOT hp DOT com (206) 335-2495