-1

I have a .c file which contains many functions. I want only one to be called outside the file, this public function calls the private functions and the private function is also call each others.

void f() {
   ....
}
void g() {
   f();
   ....  
}
void public() {
   f();
   ....
}
SYZYGY
  • 75
  • 10

1 Answers1

1

If you declare a function as static, it will only be visible by that name from inside that source file (or more accurately, from inside that translation unit):

static void f() {
   ....
}
static void g() {
   f();
   ....  
}
void public() {
   f();
   ....
}
dbush
  • 205,898
  • 23
  • 218
  • 273