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

By Prof. Fazal Rehman Shamil

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

Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.