current position:Home>Does C + + reference support multi-level nesting

Does C + + reference support multi-level nesting

2022-01-26 23:35:05 Xiao Shi of software engineering

Support

#include<iostream>
using namespace std;

void fun2(int& a){
    a = 10;
    cout << a << endl;
}

void fun1(int& a){
    a = 5;
    fun2(a);
    cout << a << endl;
}

int main(void)
{
    
    int a = 1;
    cout << a << endl;
    
    fun1(a);
    
    cout << a << endl;
    
}

 

copyright notice
author[Xiao Shi of software engineering],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/01/202201262335039987.html

Random recommended