Note that there are some explanatory texts on larger screens.

plurals
  1. POCan functions be called before "main"? If so, what happens?
    primarykey
    data
    text
    <p>I know that it is always the <em>main ()</em> function being executed first, then function calls will direct the program to other functions. What if functions were <strong>called</strong> *<em>before</em>* the <em>main ()</em> function? When will they be executed?\</p> <p>I had a program (I downloaded from the Internet) and there were function calls before main( ).</p> <p>Now I don't know what they are for if execution is only done in main () (and the the functions called inside main). </p> <p><strong>HERE IS THE FRAGMENT OF THE PROGRAM:</strong></p> <pre><code>static void set_level_indices (VideoParameters *p_Vid); static void chroma_mc_setup (VideoParameters *p_Vid); static void init_img (VideoParameters *p_Vid); static void init_encoder (VideoParameters *p_Vid, InputParameters *p_Inp); static int init_global_buffers (VideoParameters *p_Vid, InputParameters *p_Inp); static void free_global_buffers (VideoParameters *p_Vid, InputParameters *p_Inp); static void free_img (VideoParameters *p_Vid, InputParameters *p_Inp); static void free_params (InputParameters *p_Inp); static void encode_sequence (VideoParameters *p_Vid, InputParameters *p_Inp); *(SOME FUNCTION DECLARATIONS OMITTED)* int main(int argc, char **argv) { init_time(); #if MEMORY_DEBUG _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif alloc_encoder(&amp;p_Enc); Configure (p_Enc-&gt;p_Vid, p_Enc-&gt;p_Inp, argc, argv); // init encoder init_encoder(p_Enc-&gt;p_Vid, p_Enc-&gt;p_Inp); // encode sequence encode_sequence(p_Enc-&gt;p_Vid, p_Enc-&gt;p_Inp); // terminate sequence free_encoder_memory(p_Enc-&gt;p_Vid, p_Enc-&gt;p_Inp); free_params (p_Enc-&gt;p_Inp); free_encoder(p_Enc); return 0; } </code></pre> <p>Now that I thought of it, is the <em>static</em> has something to do with these calls done before main () being okay?</p> <p>This is the encoder of H.264 in its reference software.</p> <p><strong>EDIT</strong></p> <p>Are the codes above main () function calls, function prototypes or a function declaration. You all give different answers. Please choose one and explain why by presenting the format. I really thought these statements are in the form of function calls. Furthermore, can function prototypes be included in a source code and not in the header file? Thank you!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload