On Mon, May 15, 2000 at 10:24:01AM +0200, Thomas B�tzler wrote:
> First, do declare the subroutine before you call it.
> Either use a prototype, or put the function in the
> source before main (). Second, you define main
> as returning an int, but you don't return any.
> Third, bzero only needs a char *:
>
> #include <stdio.h>
> #include <string.h>
>
> int GetCookie(char *User, char *Pass){
> bzero(User,15);
> bzero(Pass,15);
> return(1);
> }
>
> int main (void){
> char User[16], Pass[16];
> GetCookie(User,Pass);
> return( 0 );
> }
In some C environments it's actually legal for main() to return without
a value; there the C compiler will threat this as equivalent to return 0;.
This is not true for gcc on Linux, there main() will return a random
value.
Some C compilers are fairly paranoid and will complain if you don't
properly declare the arguments for main().
Just a few notes by somebody who has been dealing with portability
problems again and again.
Ralf