I have a small program to test passing char* pointers in and out of functions. When I compile with cc, I get warning and errors saying I have conflicting types even though all my variables are char* . Please enlighten
#include <stdio.h>
main()
{
char* p = NULL;
foo1(p);
foo2();
}
void foo1(char* p1)
{
}
char* foo2(void)
{
char* p2 = NULL;
return p2;
}
p.c:11: warning: conflicting types for ‘foo1’
p.c:7: warning: previous implicit declaration of ‘foo1’ was here
p.c:15: error: conflicting types for ‘foo2’
p.c:8: error: previous implicit declaration of ‘foo2’ was here