I would like to ask you about the Cstatic function

Asked 2 years ago, Updated 2 years ago, 179 views

I have a question about the static function, not the c++ static method.

I know the static variable, but what is the static function? Also, if you define void myfunc() in another c file and include this c file, you cannot compile it Why does static void myfunc() compile normally?

function c static

2022-09-22 22:21

1 Answers

The static function is a function that only appears to files within the same file. (Not exactly the same file, but the same translation)

If you have any questions

//
  other files cC
void myfunc(){
    // What kind of code
}

//main파일.c
# include "other files c"

...

I think there is a link error because I wrote it with

//
  other files cC
void myfunc();

//main파일.c
# include "other files c"

myfunc()
{
    // What kind of code
}

It will be compiled normally if you switch to


2022-09-22 22:21

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.