// C++ program to swap two variables using a // user defined swap() include int main() { int x = 1024, y = 1025; int &refx = x; int &refy = y; printf(" Before Swapping: x = %d, y = %d", refx, refy); int temp = refx; refx = refy; refy = temp; printf(" After Swapping: x = %d, y = %d", refx, refy); return 0; }
Neso Academy is not just a TH-cam channel .... it is a purely academic program..such a gem🤩😍
I am astudent of telecom engineering university in Somalia 🇸🇴☺ really #neso academy helped me as much as I will thank you 😊🙏 you my best teacher ❤
We can declare constant reference to assign constant value. Like
const int &r1=10;
Good Channel for C++ Teaching , excellent Work
Loving these videos! Cant wait for more on C++!
08:39 ival is an object ? I thought it was a variable. Both are same or any difference ? Please let me know.
Sir please upload daily eagerly I am waiting for next video's
A lot of thanks sir keep always...
I love Neso Academy ❤️
very well explanaid
so it means it is impossible to do swapping using references right?
why ?
// C++ program to swap two variables using a
// user defined swap()
include
int main()
{
int x = 1024, y = 1025;
int &refx = x;
int &refy = y;
printf("
Before Swapping: x = %d, y = %d", refx, refy);
int temp = refx;
refx = refy;
refy = temp;
printf("
After Swapping: x = %d, y = %d", refx, refy);
return 0;
}
see above code, is it not right ? it's working fine.
@@rajeshprajapati6662 here in c++ having 49 video's its complete of course??? Or is there plzz telll
@@jagan_217 The course is not complete.
Please make tutorials on python also 🙏
when i declare a reference, is it a new variable in memory that has a new address or it is just a new name?
Yes and no and it depends.
Sir pls thoda sa vs code ki screen zoom kar diya karo sir because codes are looking small
Sir for c++ you added your channel only 27 videos so is that means you completed this course or steel some lesson were there to upload here ?
It's a running course dear .
you have stopped DBMS 1 month ago . please start that course 🙏🏼 . Don't stop it.
Why use a reference? Why not just use the original variable instead of a copy that contains the same value...
P
References are needed for operator overloading, copy constructors, copy assignment etc.