ASDV-WebDev/Semester 3/Assignments/functions/functions.cpp

46 lines
746 B
C++

2024-03-21 17:08:36 +07:00
/*
* 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:07AM
*/
#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;
}