TODAY JAVA SCHOOL

In java school, programming, design, computer general knowledge, web application, software, web services, social media, digital marketing, oops, concept of programming language, oops feature, console media, graphics medium, first programming, c, c ++ , Java, PHP, SQL, MySQL, HTML, HTML_5, J_query, JavaScript, Bootstrap, Framework, images with logos, examples, shared and explained.

https://www.amazon.in/b?node=26373545031&linkCode=ll2&tag=1234567801cdb-21&linkId=3b9882431b00409b44141e0344b35a15&language=en_IN&ref_=as_li_ss_tl

Breaking

Saturday 20 June 2020

Reference Parameter In C++| Reference Parameter In C++ Program | Reference Parameter In C++ Example | Reference Parameter In C++ In Hindi

Reference Parameter In C++

Whenever we pass a function of any kind to inside so we can use parameter so that time we have to use address operator so it’s known as reference parameter.

When the actually argument through the variable to pass a value, so that time if we use to define the address operator, so it called reference parameter.  


image of Reference Parameter In C++

Fig: Reference Parameter In C++

Syntax:

return type functionname(datatype &variable)

{

function of body;

}

Program:

#include<iostream.h>

#include<conio.h>

void swap(int &i, int &j);

void main()

{

int a,b;

cout<<”input two no”;

cin>>a>>b;

swap(a,b);

cout<<”a=”<<a;

cout<<”b=”<<b;

getch();

}

void swap(int &i, int &j)

{

int k;

k=i;

j=i;

i=k;

}

Output:

Input two no 12

12

a=12, b=12

 


No comments:

Post a Comment