New Post

Life Skills for Everyday Success ~xRay Pixy

Image
Life skills are the basic abilities we need to handle daily challenges and live a healthy, balanced life. They help us think clearly, manage our feelings, make good decisions, solve problems, and build good relationships with others. The World Health Organization (WHO) highlights 10 important life skills: 1.) Thinking skills: decision-making, problem-solving, creative thinking, critical thinking 2.) Social skills: communication, empathy, interpersonal skills 3.) Emotional skills: self-awareness, coping with emotions, coping with stress Life skills are the tools that make us stronger, wiser, and calmer in real life — at home, in school, at work, and in the community :) Life Skills for Everyday Success ~xRay Pixy https://youtu.be/AMsUfKRl4kw Video Chapters: Life Skills 00:00 Introduction 01:07 Life Skills 09:42 Real Life Challenge 13:44 Task For You #LifeSkills #SuccessTools #StressFreeLiving #algorithm #optimization #research #happylearning #algorithms #meta #optimizationtechniques #swa...

Call by value, Call by Reference, Returning Values from a Function

Arguments Passing Techniques
C++ is the mother of Object-Oriented Programming.
Arguments Passing is a Process of transferring data between the calling function and the called function. In C++,  there are three ways by which arguments can be passed.
  1. Pass By Value
  2. Pass By Address or Pass By Pointer
  3. Pass By Reference
Video Explanation: C++ Program to swap two numbers with the third variable.   https://youtu.be/pq9VWQswqwo

Video: Call By Value
Most of the programming languages like C use only the first two modules (i.e., Passing by Value and Address) whereas C++ supports all the three methods of passing arguments.

Pass By Value: It is a default method for argument passing. When an argument is passed by value than a copy of the argument is made and passed to the newly created formal arguments in the called function. The formal arguments contain a copy of actual arguments which is stored in the separate memory location.  

Program to Show How Pass By Value Works. C++ Program to swap two numbers with the third variable.
PROGRAM OUTPUT: -


Pass By Reference:
The Pass by reference is the very easy and simple technique of argument passing which is only available in C++(not in C). This technique allows modifications back to the actual arguments.


OUTPUT: 


Explanation: The above program shows swapping of 2 numbers using pass by reference. When the function swap(a,b); is called, the actual arguments a and b are passed by reference. 
In the function definition, the formal arguments x and y are reference variables of the corresponding actual arguments a and b respectively. 

Comments

Popular Post

PARTICLE SWARM OPTIMIZATION ALGORITHM NUMERICAL EXAMPLE

Cuckoo Search Algorithm for Optimization Problems

Particle Swarm Optimization (PSO)

PSO (Particle Swarm Optimization) Example Step-by-Step

how is the LBP |Local Binary Pattern| values calculated? Step-by-Step with Example

PSO Python Code || Particle Swarm Optimization in Python || ~xRay Pixy

Grey Wolf Optimization Algorithm

Grey Wolf Optimization Algorithm Numerical Example

Bat algorithm Explanation Step by Step with example

Whale Optimization Algorithm Code Implementation || WOA CODE || ~xRay Pixy