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

Returning Reference In C++| Returning Reference In C++ Program| Returning Reference In C++ Example| Returning Reference In C++Programming Language| Returning Reference In C++ In Hindi

Returning Reference In C++

The name of variable to reference return should done so if variable is reference type so function should be reference type which we needed.

If the reference variable is return type so function should returning reference we have a value which can replace form one place to another place so there  we have to use assignment operator.

image of returning reference in c++

Fig:Returning Reference In C++

Syntax:

returntype &functionname (&argument list)

{

function of body;

}

Program:

#include<iostream.h>

#include<conio.h>

char &replace(int a);

char name[30];

void main

{

cout<<”input string”;

cin>>name;

replace (5)=’c’;

cout<<name;

getch();

char &replace(int a)

{

return name[a];

}

Output:

Input value

Pramod

Pramcd

 


No comments:

Post a Comment