Code:
#include < iostream >
using namespace std;
int a;
char ch;
void test2(char& x, int c){
int b;
a = x - 'x';
cout << a << c;
b = a+c;
x--;
cout << b << x << ch << endl;
cout << "\n";
cout << endl;
}
int main(){
int b;
a = 26;
b = 31 / a;
ch = 'z';
cout << "12345678901234567890\n";
cout << "a= " << a << " b= " << b << " ch= " << ch << endl;
test2(ch,a);
cout << "a= " << a << " b= " << b << " ch= " << ch << endl;
test2(ch,b);
cout << "a= " << a << " b= " << b << " ch= " << ch << endl;
}
in int main
test2(ch,a); is placed after the 2nd set of cout data is this just basically telling the function to compute this data at this point in the program?
And because the function is a void function will the changes made to the variables within the function carry out of the function? in other words will the function permanently alter the variables or will they return to their previous values when the function exits?
And will 31/a equal anything other then 31/a? how about x- 'x' and a+c sorry I cant remember