Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What is the function of fun function?
What is the function of fun function?

You have to look at the content of the function body of the fun() function. fun() is just a function name. How you write the function body inside determines its function. For example:

< p>void fun()

{

printf("The function of this fun() function is to output text\n");

}

void fun()

{

int a,b,c;

a=7;

b= 8;

c=a+b;

printf("The function of this fun() function is to calculate the value of a+b. c=%d\n",c) ;

}

In C/C++ language, the fun function is usually called by the main function. It refers to using fun to define a function (or method), so that it can be expressed as fun when referencing. For example, int fun(int x,int y), void fun(char* a, char* b) and so on. With the previous definition, you can call it in the main function, such as ans=fun(3,7); or fun(p1,p2);.

The fun function is a custom function. The word fun has no other meaning except that it is used to represent the function when it is called.

Extended information:

There is no fun function in the C/C++ language standard library. The fun function is a custom function that is used for examples or syntax demonstrations. It needs to be defined and declared by itself before use.

The word fun has no special meaning and can also be replaced by other names, such as "abc" or "baidubaike". It only means referencing the function that appeared before to call it to perform some requirements. int fun (int x, int y) is just an example of a function name and its declared parameter type.

The strlen(char*) function finds the actual length of the string. The method of finding it is from the beginning to the first '\0'. If you only define it without assigning an initial value to it , this result is uncertain, it will search from the first address of aa until it encounters '\0' and stops.

clock_t is actually long, that is, long integer. The return value of this function is the number of hardware ticks. To convert it into seconds or milliseconds, you need to divide it by CLK_TCK or CLOCKS_PER_SEC.

For example, under VC++6.0, the values ??of these two quantities are 1000, which means that 1000 hardware ticks is 1 second. Therefore, to calculate the time of a process, divide by clock() 1000 is enough.

See the first example for details. Note: This function can only return ms-level timing accuracy (in fact, the achievable timing accuracy is roughly equivalent to the thread switching time of the operating system. On the Windows platform, the ultimate accuracy is approximately 15~16ms). If US-level timing accuracy is required, the Linux system can use the library function: gettimeofday().

Reference material: Baidu Encyclopedia - fun function