0

I am having trouble in understanding why gcc cannot differentiate between the following functions:

void a(int* p);
void a(void);
int* a(int p); 

void a(int* p){}
void a(void){}
int* a(int p) {return (void*)0;}

During compilation "error: conflicting types for ‘a’" and "note: previous declaration was here" errors are being returned.

opalenzuela
  • 3,139
  • 21
  • 41
Sebi
  • 4,262
  • 13
  • 60
  • 116

1 Answers1

1

You're trying to overload a function in C. This is a C++ feature. In C a function can have a single prototype.

egur
  • 7,830
  • 2
  • 27
  • 47