Skip to Main Content
John B. Coleman Library Ask A Librarian

COMP 1336 - Computer Science I: C++ Lessons: Functions

Head of Reference and Information Services Department, Librarian II

Functions

Functions

Function - segment of code that is ran whenever the function is called. Functions exist outside of the main body of code, but can be called multiple times. Functions can also take in values / variables, which will often yield different outputs or returns from the function.

Void function - a function with no return statement. Although, multiple values can be retained by using pointers in parameters.

Value-returning function - a function that returns a value when it's finished.

See example below.

 

John B. Coleman Library
Mailing Address: P.O. Box 519, MS 1040, Prairie View, Texas 77446
Physical Address: L.W. Minor St. / University Drive, Prairie View, Texas 77446
Reference: (936) 261-1535, Circulation: (936) 261-1542
Email: askalibrarian@pvamu.edu

Library Hours