Skip to main content

Practical-11

Write a cpp program which explain concept of " object as a arguments".

Introduction

Code

Practical-11.cpp


//include the library
#include<iostream>
using namespace std;

//this function will be taking object argument
void printData(int temp){

//print the argument value
cout << "Value of argument: " << temp << endl;
}

//main function
void main(){

//declare a object
int x = 10;

//call the printData() function
//and pass the object as the argument
printData(x);

return 0;
}

Output

Value of argument: 10