C advanced programming-function pre-and post-call

Source: Internet
Author: User

 

//////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// /////////////////

 

Pass the test in linux gcc (submit if any Bug exists)

 

To use this code, you need to note the author: fqheda

 

This Code complies with the GPL V3.0 standard and is free of charge-function pre-and post-call

 

Note: In the same. c, when function A calls another function B, if function B

 

Located in front of function A, which can be called A pre-function call. This mode is called directly.

 

If function B is behind function A, it can be called the function suffix.

 

Call. You need to declare it before function A and then call it.

 

 

//////////////////////////////////////// //////////////////////////////////////// //////////////////////////////////////// ////////////////////

 

/* Function call mode */

 

# Include <stdio. h>

 

Void func_behind (void );

 

Void func_before (void)

{

Printf ("\ n @: before function call !!! \ N ");

}

 

Int main (int argc, char ** argv)

{

Func_behind ();

Func_before ();

 

Return 0;

}

 

Void func_behind (void)

{

Printf ("\ n @: behind function call !!! \ N ");

 

}

 

Execution result (UBUNTU 10.04-GCC4.4 compilation)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.