Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
ECE2574_Function_Calling_Example
// clang 3.8.0 // Example from Lecture 5 in class on calling functions // by reference and vale #include <iostream> using namespace std; void myFuncByValue(int n) { n++; } void myFuncByReferenceCStyle(int *n) { (*n)++; } void myFuncByReferenceCppStyle(int &n) { n++; } int main() { int i = 3; cout << "Test Program for calling functions" << endl; // Calling by value cout << "Value of i prior to calling myFuncByValue is: " << i << endl; myFuncByValue(i); cout << "Value of i after to calling myFuncByValue is: " << i << endl; // Calling by reference C-style cout << "Value of i prior to calling myFuncByReferenceCStyle is: " << i << endl; myFuncByReferenceCStyle(&i); cout << "Value of i after to calling myFuncByReferenceCStyle is: " << i << endl; // Calling by reference C++-style cout << "Value of i prior to calling myFuncByReferenceCppStyle is: " << i << endl; myFuncByReferenceCppStyle(i); cout << "Value of i after to calling myFuncByReferenceCppStyle is: " << i << endl; return 0; }
run
|
edit
|
history
|
help
0
NaN inside set
12/2
Array-Based Heap Example Solution
numeric_limits
C++ Operator Overloading
SceneGraph Interviewee Task
Graphs Iteration1 Undirected.
applidiumResto_NicolasCarre
Unqualified free functions
LOOL