Chapter 4 Function Assignment questions, built-in functions, and Chapter 4 assignment questions

Source: Internet
Author: User

Chapter 4 Function Assignment questions, built-in functions, and Chapter 4 assignment questions

What are built-in functions? It is also an inline function.

A function embedded in the main function is called a built-in function, that is, although the function is written outside of main (), it is identified by the keyword inline, in this way, the function written outside can be written in the main function main.

What is the difference between writing a function out of the main function and writing it in the main function?
Can run normally, but the program efficiency is different. Writing in the main function has a high efficiency, because it is a waste of resources and time to keep the site outside for searching.

Example: 4.7

# Include <iostream> using namespace std; int max (int x, int y, int z); int main () {int a, B, c, m; cout <"Enter three integer numbers:" <endl; cin> a> B> c; m = max (a, B, c ); // The actual parameter, representing The specific value. In (), cout <"The max of a B and c is:" <m <endl; system ("pause"); return 0;} // inline function one keyword inline int max (int x, int y, int z) {if (z> x) x = z; if (y> x) x = y; return x ;}

 

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.