Reference Variables | C++ Tutorial

  Рет қаралды 4,961

Portfolio Courses

Portfolio Courses

Күн бұрын

How to use reference variables in C++, including using references as parameters (pass-by-reference), using references as return values, and using a reference to a function. Source code: github.com/por.... Check out www.portfolioc... to build a portfolio that will impress employers!

Пікірлер: 9
@yt-1161
@yt-1161 9 ай бұрын
11:15 what if the function accepts many arguments of different types ?
@nurr_codee
@nurr_codee 2 ай бұрын
Your are awesome. Thank You!
@germankoga8640
@germankoga8640 Жыл бұрын
So, reference variables would still be memory adresses to the variable the've been set to point to, just in a safer way because it disallows certain behavior of pointers? and also they seem to get derreferenced automatically
@PortfolioCourses
@PortfolioCourses Жыл бұрын
Great question Brandon! :-) Technically a reference is an alias for another variable. So it's not really a pointer, so much as it is just another way of accessing another variable. Which is something we can do with pointers too, so yes as a practical matter it does feel like a 'safer' constant pointer with automatic dereferencing. But technically, within the C++ language, it's just another name and way to access another variable. We could say that a pointer points to another variable, but a reference *is* the variable.
@germankoga8640
@germankoga8640 Жыл бұрын
@@PortfolioCourses Oh it's just that I got confused by the use of the & which in C was to reference a variable's memory adress, so I thought here it was more or less the same principle, and also I didn't see in first sight why would I want an alias variable, thank you for the fast answer, I'm introducing myself from C to C++ with this playlist, also I take the opportunity to suggest the video ideas of lambdas(interested in the functional programming features of cpp), smart pointers and RAII pattern, thanks again, I also used the C playlist to get deeper into that
@PortfolioCourses
@PortfolioCourses Жыл бұрын
Those are all great ideas and videos I want to make one day. :-) I'm glad you're enjoying the playlists!
@rakshithabk1827
@rakshithabk1827 2 жыл бұрын
Please make video for add line numbers to a file . The file name should be as command line arguments
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
Thank you for the idea! I will add this to my list of video ideas. :-)
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
I just published the video now: Add Line Numbers To A File | C Programming Example kzbin.info/www/bejne/g5OnqKiqZsdknqc. :-)
Member Initializer Lists | C++ Tutorial
23:10
Portfolio Courses
Рет қаралды 9 М.
References in C++ Explained
14:21
Caleb Curry
Рет қаралды 103 М.
Creative Justice at the Checkout: Bananas and Eggs Showdown #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 28 МЛН
Чистка воды совком от денег
00:32
FD Vasya
Рет қаралды 4,4 МЛН
REFERENCES in C++
10:13
The Cherno
Рет қаралды 588 М.
this Keyword And Use Cases Explained | C++ Tutorial
10:30
Portfolio Courses
Рет қаралды 7 М.
you will never ask about pointers again after watching this video
8:03
2 Years of C++ Programming
8:20
Zyger
Рет қаралды 8 М.
C++ Tutorial:  Returning values by reference
11:34
Professor Hank Stalica
Рет қаралды 3,9 М.
Class Templates | C++ Tutorial
12:48
Portfolio Courses
Рет қаралды 55 М.
31 nooby C++ habits you need to ditch
16:18
mCoding
Рет қаралды 829 М.
C++ pointers explained easy 👈
5:16
Bro Code
Рет қаралды 46 М.
new & delete Operators For Dynamic Memory Allocation | C++ Tutorial
15:52
Portfolio Courses
Рет қаралды 32 М.
Creative Justice at the Checkout: Bananas and Eggs Showdown #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 28 МЛН