{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

L08userfuncs - Predefined Functions Revisited q q q q q q...

Info icon This preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
what are predefined functions? what is: ? function name argument(s) return value function call function invocation what is the type of arguments and the type of return value and why are they important? what is include directive and how is it related to predefined functions? what are type changing functions and why are they needed? what is type casting? Predefined Functions Revisited
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Programmer-Defined Functions
Image of page 2
Functions are named portions of code Two types of functions: predefined - provided in libraries for the benefit of all programmers programmer-defined - written by programmer To carry out its task the function accepts arguments To use a function the programmer writes the function name and a list of arguments for the function to use. This is called function call (or function invocation ) every function returns a result in a return value a function call can be used in any place an expression or statement is used if a function is used as an expression - the function evaluates to its return value if a function is used as a statement - the return value is ignored arguments and return value of a function are of specified type Functions
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Function Invocation cout << add1(4+5) << endl; Invocation is part of a larger expression. To process the invocation, the function that contains the insertion statement is suspended and add1() does its job. The insertion statement is then completed using the value supplied by add1() .
Image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern