I will have two files. One header.h file and second one is main.c file.
Now, how to make a header.h file with methods written in C (such as print test etc), then in main.c file, how can I access them with operators such as :: or ->
@file: main.c
#include "header.h"; // sorry i made mistake before
int main()
{
A::myStaticFunction();
// OR
A->myInstanceFunction();
return 0;
}
Not completely possible. What you got there is C++ code, it can’t be emulated in C in exactly that way.
In C, a
structcan’t have functions, only function pointer and also can’t have anystaticmembers at all. So, no::for you in that regard. Your other example, on @David’s answer, is most likely anenum:Now, to get one of those values inside the enum you can just use the name (
IgnoreCall) or qualify it with the enum’s name (H323Connection::IgnoreCall).The
->operator, however, is totally possible.