Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!uwmcsd1!marque!lakesys!davek From: davek@lakesys.UUCP (Dave Kraft) Newsgroups: comp.lang.c Subject: Prototyping help needed Keywords: ANSI standards, prototyping, etc. Message-ID: <414@lakesys.UUCP> Date: 21 Feb 89 21:39:47 GMT Organization: Lake Systems - Milwaukee, Wisconsin Lines: 45 Hi, I have a question: How come the following small program works under Turbo C 1.5 and not under Unix? main() { int a = 0, b = 0, c; int add(int, int); printf("\nEnter 2 ints: "); scanf("%d%d", &a, &b); c = add(a, b); printf("\nc = %d\n\n", c); } int add(int a, int b) { return(a + b); } Now, when I code it as follows: main() { int a = 0, b = 0, c; int add(int, int); printf("\nEnter 2 ints: "); scanf("%d%d", &a, &b); c = add(a, b); printf("\nc = %d\n\n", c); } int add(a, b) int a, b; { return(a + b); } It works as it should. Why?? -- davek@lakesys.lakesys.com -or- uunet!marque!lakesys!davek "The meek will inherit the earth, the rest of us will go to the stars" -- 'Omni' (magazine) button