Passing by Value and Passing by Reference using structures in C++

Let us see the C++ program for finding the length of the string by passing values to the function.

We can also pass a structure to a function in two different ways. These two ways are mentioned below;

  1. Passing by Value
  2. Passing by Reference

Passing by Value to the function using structures in C++ (Length of string program)

Passing by Value to the function using structures in C++

Output

please enter your desired string

t4tutorials

The length of your desired string is: 11

Passing by Reference to the function using structures in C++ (Length of string program)

Passing by Reference to the function using structures in C++

Output

please enter your desired string

welcome

The length of your desired string is: 7

By: Prof. Fazal Rehman Shamil    CEO @ T4Tutorials
Whatsapp: +92 302 87 000 85     Facebook: For Discussions