46 lines
746 B
C++
46 lines
746 B
C++
/*
|
||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||
* Click nbfs://nbhost/SystemFileSystem/Templates/cppFiles/main.cc to edit this template
|
||
*/
|
||
|
||
/*
|
||
* File: functions.cpp
|
||
* Author: caleb
|
||
*
|
||
* Created on March 1, 2024, 10:07 AM
|
||
*/
|
||
|
||
#include <cstdlib>
|
||
#include <iostream>
|
||
|
||
using namespace std;
|
||
#include "functions.h"
|
||
|
||
int global = 0;
|
||
|
||
void f1() {
|
||
cout << "f1()" << endl;
|
||
global++;
|
||
f2();
|
||
}
|
||
|
||
void f2() {
|
||
cout << "f2()" << endl;
|
||
global++;
|
||
}
|
||
|
||
void passByReference(int& x) {
|
||
global++;
|
||
x = 100;
|
||
}
|
||
|
||
void staticVarFunction() {
|
||
static int staticInt = 10;
|
||
staticInt++;
|
||
cout << staticInt << endl;
|
||
}
|
||
|
||
int& returnReference (int & x) {
|
||
x++;
|
||
return x;
|
||
} |