It becomes a pain to keep juggling functions around to avoid this problem. Better to declare all functions at the top of the file with a prototype, like I suggested. Then you don't care about the order of the functions.
Andy Kirk Wallace wrote: > On Tue, 2008-02-12 at 15:36 -0700, Andrew Ayre wrote: >> The first time the compiler comes across the function it doesn't know >> the prototype, so it assumes that it returns an int. Then when it comes >> across the function declaration it is different. >> >> The "type" of a function is defined by the return type and the parameter >> types which must always match when the function is declared and when it >> is defined. >> >> Add the following after the #include but before the main function: >> >> unsigned short CRC16(unsigned char *puchMsg, unsigned short usDataLen); >> >> This will define the function so nothing is assumed by the compiler. >> >> Andy > > Thanks, Andy and Ken. I seem to recall from another life long ago that > main usually went at the bottom of C files. Now I know why, and how to > cheat. > > I found this website to check my CRC program: > > http://www.lammertbies.nl/comm/info/crc-calculation.html?crc=104100000102FF00&method=hex > > and we agree. 10 41 00 00 01 02 FF 00 CRC16's to CF F1 , cool. > -- Andy PGP Key ID: 0x67090A54 ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users