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
non-template template parameters for container stream insertion: SFINAE
<string> No indirect include of <errno.h>
001
Fun with Pointers #2
why
HexDong
problem_name_4
tuple, order of members
STL stack
Reference example