unknown funtion problem

I wrote 2 different source files.When I compile the code compiler gave an error message "conflicting types for bar".if,I write entire program in 1 file , it works.

//File1//

#include<stdio.h>

void foo ( void );
void bar(void);
void baz(void);

int main ( )
{

foo();

return 0;
}
//File2//

void foo ( void )
{
bar();
}

void bar ( void )
{
printf("hello world !\n");
}

void baz ( void )
{

}

Last edited on
It's because you have to put the prototypes before the definitions of the functions. Also, you should use .cpps to store the code/stuff, and the .hs to store protoypes/other declarations.
Topic archived. No new replies allowed.