W
What is the output of the program?
#include <iostream>
using namespace std;
void trick (int *templ, int *temp2)
{
int *temp=templ;
templ=temp2;
temp2=temp;
}
int main() {
int a=100;
int b=200;
int c=300;
trick (&a, &b);
trick (&a,&c);
cout <<b;
}
Answers
Answered by
28
Required Answer :
Given program:
#include <iostream>
using namespace std;
void trick (int *templ, int *temp2)
{
int *temp=templ;
templ=temp2;
temp2=temp;
}
int main() {
int a=100;
int b=200;
int c=300;
trick (&a, &b);
trick (&a,&c);
cout <<b;
}
To find:
- The output of the given program.
Output:
The output of the given program will be as follows:
200
[Note: The given cοde is from C++ program.]
Extra information :
- C++ is an oriented programming language.
- C++ program originated from C programming language.
- C++ program is also known as C with classes.
- C++ program is developed by Bjarne Stroustrup.
- C++ program is developed in the early 1980s at USA.
- C++ program is an advanced version of C program.
Similar questions